This commit is contained in:
redkale
2024-09-24 12:31:12 +08:00
parent 97e732e9e3
commit 242f668aa6
3 changed files with 6 additions and 4 deletions

View File

@@ -219,7 +219,7 @@ public final class EnMember<W extends Writer, T, F> {
@Override
public String toString() {
return "EnMember{" + "attribute=" + attribute.field() + ", position=" + position + ", encoder="
return "EnMember{" + "attribute=" + attribute.field() + ", position=" + position + ", tag=" + tag + ", encoder="
+ (encoder == null ? null : encoder.getClass().getName()) + '}';
}
}

View File

@@ -25,7 +25,7 @@ public class ProtobufFactory extends ConvertFactory<ProtobufReader, ProtobufWrit
"redkale.convert.nullable",
false,
Convert.FEATURE_NULLABLE),
Boolean.parseBoolean(System.getProperty("redkale.convert.protobuf.enumtostring", "true")));
Boolean.parseBoolean(System.getProperty("redkale.convert.protobuf.enumtostring", "false")));
static final Decodeable objectDecoder = instance.loadDecoder(Object.class);

View File

@@ -410,8 +410,10 @@ public class ProtobufWriter extends Writer implements ByteTuple {
value = objFieldFunc.apply(member.getAttribute(), obj);
}
if (value == null) {
this.writeFieldName(member);
writeNull();
if (nullable()) {
this.writeFieldName(member);
writeNull();
}
return;
}
if (tiny()) {