chaokunyang commented on code in PR #2191:
URL: https://github.com/apache/fury/pull/2191#discussion_r2084440915
##########
java/fury-core/src/main/java/org/apache/fury/builder/BaseObjectCodecBuilder.java:
##########
@@ -375,6 +371,45 @@ protected Expression serializeFor(
}
}
+ protected Expression serializeForNullable(
+ Expression inputObject, Expression buffer, TypeRef<?> typeRef, boolean
nullable) {
+ return serializeForNullable(inputObject, buffer, typeRef, null, false,
nullable);
+ }
+
+ protected Expression serializeForNullable(
+ Expression inputObject,
+ Expression buffer,
+ TypeRef<?> typeRef,
+ Expression serializer,
+ boolean generateNewMethod,
+ boolean nullable) {
+ if (needWriteRef(typeRef)) {
+ return new If(
+ not(writeRefOrNull(buffer, inputObject)),
+ serializeForNotNull(inputObject, buffer, typeRef, serializer,
generateNewMethod));
+ } else {
+ // if typeToken is not final, ref tracking of subclass will be ignored
too.
+ if (typeRef.isPrimitive()) {
+ return serializeForNotNull(inputObject, buffer, typeRef, serializer,
generateNewMethod);
+ }
+ if (nullable) {
+ Expression action =
+ new ListExpression(
+ new Invoke(
+ buffer,
+ "writeByte",
+ new Literal(Fury.NOT_NULL_VALUE_FLAG,
PRIMITIVE_BYTE_TYPE)),
Review Comment:
Literal.ofByte
--
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]