Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the way Modules configure, interact with ObjectMapper #4

Closed
cowtowncoder opened this issue Aug 20, 2017 · 1 comment
Closed

Comments

@cowtowncoder
Copy link
Member

(note: see #3 as background)

Assuming that ObjectMapper is to be made immutable by introduction of Builder-pattern, existing setup context (Module.SetupContext) will not work as is.

At minimum, setup context would need to work on matching Builder object, but the bigger question is when and how would a Module be registered. The straight-forward way seems to be to require registration through Builder object itself, but in such a way that reference to Module would be retained until builder's build() method is called.

But beyond basic builder-flow, even bigger question is that of ability to "modify" an existing mapper ("rebuild"). While it would be possible to just either try to retain settings (possibly via serializer/deserializer caches, as well as other handler chains), it seems better to actually require mapper to remember Modules registered, and re-register modules if a new copy is created.
This in turn requires full clean up of all state, or, more likely, construction of a fresh mapper instance.

Going this route will probably add some overhead compared to current usage of ObjectMapper.copy(), but should be more correct, prevent many potential problem cases, and be all around more robust.
Another potential downside is that there will now be linkage from mapper to modules (Jackson 2.x and earlier did NOT retain a reference to module). But that does not seem like a major problem; just needs to be someone Module authors need to keep in mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant