chaokunyang commented on code in PR #1932:
URL: https://github.com/apache/fury/pull/1932#discussion_r1833026479
##########
java/fury-core/src/main/java/org/apache/fury/serializer/NonexistentClassSerializers.java:
##########
@@ -208,23 +210,35 @@ public Object read(MemoryBuffer buffer) {
fury, refResolver, classResolver, fieldInfo, isFinal[i],
buffer);
}
}
- entries.add(new MapEntry(fieldInfo.qualifiedFieldName, fieldValue));
+ entries.add(new MapEntry(getFileName(fieldInfo.qualifiedFieldName,
config), fieldValue));
}
for (ObjectSerializer.GenericTypeField fieldInfo :
fieldsInfo.otherFields) {
Object fieldValue = ObjectSerializer.readOtherFieldValue(fury,
fieldInfo, buffer);
- entries.add(new MapEntry(fieldInfo.qualifiedFieldName, fieldValue));
+ entries.add(new MapEntry(getFileName(fieldInfo.qualifiedFieldName,
config), fieldValue));
}
Generics generics = fury.getGenerics();
for (ObjectSerializer.GenericTypeField fieldInfo :
fieldsInfo.containerFields) {
Object fieldValue =
ObjectSerializer.readContainerFieldValue(fury, generics,
fieldInfo, buffer);
- entries.add(new MapEntry(fieldInfo.qualifiedFieldName, fieldValue));
+ entries.add(new MapEntry(getFileName(fieldInfo.qualifiedFieldName,
config), fieldValue));
}
obj.setEntries(entries);
return obj;
}
}
+ public static String getFileName(String qualifiedFieldName, Config config) {
+ if (config.deserializeNonexistentClassNotWriteFullClassInfo()) {
+ int index = qualifiedFieldName.lastIndexOf(".");
+ if (index < 0) {
+ return qualifiedFieldName;
+ }
+ return qualifiedFieldName.substring(index + 1);
Review Comment:
This will create a new string everytime for deserialization, which is very
slow. A better method is rename `fieldInfo#qualifiedFieldName` into
`fieldInfo#fieldName`, and build it as qualified based on the option.
--
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]