chaokunyang commented on code in PR #2036:
URL: https://github.com/apache/fury/pull/2036#discussion_r2051739087
##########
java/fury-core/src/main/java/org/apache/fury/serializer/AbstractObjectSerializer.java:
##########
@@ -107,30 +108,71 @@ static Object readFinalObjectFieldValue(
fieldValue = refResolver.getReadObject();
}
} else {
- byte headFlag = buffer.readByte();
- if (headFlag == Fury.NULL_FLAG) {
- fieldValue = null;
- } else {
- typeResolver.readClassInfo(buffer, fieldInfo.classInfo);
- fieldValue = serializer.read(buffer);
+ if (!nonNull) {
+ byte headFlag = buffer.readByte();
+ if (headFlag == Fury.NULL_FLAG) {
+ return null;
+ }
}
+ typeResolver.readClassInfo(buffer, fieldInfo.classInfo);
+ fieldValue = serializer.read(buffer);
}
}
return fieldValue;
}
+ static Object readNullable(
+ SerializationBinding binding,
+ MemoryBuffer buffer,
+ Serializer<Object> serializer,
+ boolean nonNull) {
+ if (!nonNull) {
+ return binding.readNullable(buffer, serializer);
+ } else {
+ return binding.read(buffer, serializer);
+ }
+ }
+
+ static void writeNullable(
Review Comment:
How about adding those methods in `SerializationBinding` interface?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]