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 #1955

Closed
cowtowncoder opened this issue Mar 1, 2018 · 0 comments
Closed

Change the way Modules configure, interact with ObjectMapper #1955

cowtowncoder opened this issue Mar 1, 2018 · 0 comments
Labels
Milestone

Comments

@cowtowncoder
Copy link
Member

(from FasterXML/jackson3-dev#4)

Related to #1954, one significant change is the way in which Modules register their functionality with ObjectMapper. Changes are needed due to immutability of mappers; however, since Module.SetupContext is an existing abstraction, much or most changes can be insulated.

One necessary change is that owner, accessible via getOwner() of Module.SetupContext, can not be ObjectMapper being built -- it may or may not exist, but more importantly, it is immutable.
The most logical thing to do is to expose actual Builder, but need to use that entity should be minimized (which was already true for owner -- it is is and was a fallback).

Some additional changes that are needed:

  • Mapper, its builder, and saved state (for rebuilding, JDK serialization) will have to keep track of Modules to register, so there is a new dependency.
    • as a result Modules now SHOULD be java.io.Serializable; otherwise registering one will prevent ObjectMapper instance from being serializable
  • Modules are encouraged to try to do as much as possible dynamically in setupModule() method instead of pre-constructing things, and to minimize serializable state they keep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant