protobuf
This commit is contained in:
@@ -33,10 +33,15 @@ public class RequiredBeanTest {
|
||||
+ "0x1a,0x03,0x63,0x63,0x63,0x1a,0x03,0x64,0x64,0x64,0x22,0x02,0x02,0x04]");
|
||||
Utility.println("序列化0: ", bytes);
|
||||
RequiredArray array = new RequiredArray();
|
||||
array.beans = new RequiredBean[] {bean};
|
||||
array.id = 32;
|
||||
array.beans = new RequiredBean[] {bean, null, bean};
|
||||
byte[] bytes2 = convert.convertTo(array);
|
||||
System.out.println("序列化s: 29.[0x1f,0x0a,0x1a,0x08,0x0c,0x12,0x03,0x61,0x61,0x61,0x12,0x03,0x62,0x62,0x62,"
|
||||
+ "0x1a,0x03,0x63,0x63,0x63,0x1a,0x03,0x64,0x64,0x64,0x22,0x02,0x02,0x04]");
|
||||
System.out.println("序列化s: 60.[0x0a,0x1a,0x08,0x0c,0x12,0x03,0x61,0x61,0x61,0x12,0x03,0x62,0x62,0x62,"
|
||||
+ "0x1a,0x03,0x63,0x63,0x63,0x1a,0x03,0x64,0x64,0x64,0x22,0x02,0x02,0x04,"
|
||||
+ "0x0a,0x00,"
|
||||
+ "0x0a,0x1a,0x08,0x0c,0x12,0x03,0x61,0x61,0x61,0x12,0x03,0x62,0x62,0x62,"
|
||||
+ "0x1a,0x03,0x63,0x63,0x63,0x1a,0x03,0x64,0x64,0x64,0x22,0x02,0x02,0x04,"
|
||||
+ "0x10,0x40]");
|
||||
Utility.println("序列化s: ", bytes2);
|
||||
System.out.println("-----------------------------------------------");
|
||||
String jsons1 = JsonConvert.root().convertTo(array);
|
||||
@@ -51,6 +56,9 @@ public class RequiredBeanTest {
|
||||
@ConvertColumn(index = 1)
|
||||
private RequiredBean[] beans;
|
||||
|
||||
@ConvertColumn(index = 2)
|
||||
private int id;
|
||||
|
||||
public RequiredBean[] getBeans() {
|
||||
return beans;
|
||||
}
|
||||
@@ -58,6 +66,14 @@ public class RequiredBeanTest {
|
||||
public void setBeans(RequiredBean[] beans) {
|
||||
this.beans = beans;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
public static class RequiredBean {
|
||||
|
||||
@@ -7,7 +7,6 @@ package org.redkale.test.convert.pb;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
@@ -142,28 +141,17 @@ public class UserBean {
|
||||
private List<Byte> bit6;
|
||||
|
||||
@ConvertColumn(index = 41)
|
||||
private Map<String, String> map;
|
||||
|
||||
@ConvertColumn(index = 42)
|
||||
public UserKind kind;
|
||||
|
||||
@ConvertColumn(index = 43)
|
||||
@ConvertColumn(index = 42)
|
||||
public AtomicInteger count;
|
||||
|
||||
@ConvertColumn(index = 44)
|
||||
@ConvertColumn(index = 43)
|
||||
public AtomicLong[] count2;
|
||||
|
||||
@ConvertColumn(index = 45)
|
||||
@ConvertColumn(index = 44)
|
||||
private List<String> strs;
|
||||
|
||||
public Map<String, String> getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
public void setMap(Map<String, String> map) {
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
public List<Integer> getId6() {
|
||||
return id6;
|
||||
}
|
||||
|
||||
@@ -78,10 +78,6 @@ public class UserBeanProtoDynEncoder extends ProtobufDynEncoder<UserBean> {
|
||||
out.writeFieldBytesValue(23, value.getBit6());
|
||||
out.writeFieldStringsValue(23, value.getStrs());
|
||||
|
||||
out.writeFieldValue(100, value.kind);
|
||||
out.writeFieldValue(101, value.count);
|
||||
out.writeFieldValue(102, value.count2);
|
||||
|
||||
out.writeObjectField(mapEnMember, value);
|
||||
out.writeObjectE(value);
|
||||
offerWriter(out0, out);
|
||||
|
||||
Reference in New Issue
Block a user