LiangliangSui commented on code in PR #2999:
URL: https://github.com/apache/fory/pull/2999#discussion_r2596905205
##########
java/fory-core/src/main/java/org/apache/fory/serializer/collection/CollectionSerializer.java:
##########
@@ -61,7 +61,11 @@ public T copy(T originCollection) {
if (needToCopyRef) {
fory.reference(originCollection, newCollection);
}
- copyElements(originCollection, newCollection);
+ onCollectionCopy(originCollection, newCollection);
return (T) newCollection;
}
+
+ protected void onCollectionCopy(Collection originCollection, Collection
newCollection) {
Review Comment:
In the `CollectionSerializer#copy` method, it is a framework. The specific
logic for the copy operation is different. I don't think it's necessary to
rewrite the entire logic all over again.
```java
public T copy(T originCollection) {
if (isImmutable()) {
return originCollection;
}
Preconditions.checkArgument(supportCodegenHook);
Collection newCollection = newCollection(originCollection);
if (needToCopyRef) {
fory.reference(originCollection, newCollection);
}
copyElements(originCollection, newCollection);
return (T) newCollection;
}
```
--
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]