Can ObjectCopier be reused #339
-
The ObjectCopier is a simple utility that "just" copied stuff, so I'd assume it should be reusable. But if it was, I'd expect it to just be a static function. But given that it is actually a closable instance, I guess it caches some stuff or so? Maybe the class should have some java doc explaining correct usage. The annoying part about always creating new instances, is that it spams the logs quite a lot.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Making deep copies of java objects is a bit more complex. The Object Copier internally serializes and deserialized the passed object graph to create such a deep copy. |
Beta Was this translation helpful? Give feedback.
Making deep copies of java objects is a bit more complex. The Object Copier internally serializes and deserialized the passed object graph to create such a deep copy.
Initializing the Object Copier is an expensive task therefore you should try to reuse existing instances if possible.
In case the log messages are annoying you may disable logging. The logger in your example output is namend
org.eclipse.serializer.persistence.types.PersistenceCustomTypeHandlerRegistry
.