Skip to content

any way to modify existing instance's fields rather than creating new instances? #362

Answered by Machine-Maker
portlek asked this question in Support
Discussion options

You must be logged in to vote

You can get a Mutable ObjectFactory which you can then load an existing instance from a configuration node.

ObjectMapper.Factory factory = (ObjectMapper.Factory) Objects.requireNonNull(node.options().serializers().get(type));
ObjectMapper.Mutable<T> mutable = (ObjectMapper.Mutable<T>) factory.get(type);
mutable.load(instance, node);

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by zml2008
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #361 on December 05, 2022 03:10.