Skip to content

Allow construction of "format-bending" ObjectMapper.Builders? #2722

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

Closed
cowtowncoder opened this issue May 16, 2020 · 2 comments
Closed

Allow construction of "format-bending" ObjectMapper.Builders? #2722

cowtowncoder opened this issue May 16, 2020 · 2 comments

Comments

@cowtowncoder
Copy link
Member

(note: continuation from FasterXML/jackson-dataformats-binary#205)

Sometimes it would be valuable to be able to construct ObjectMapper types with different backing format: for example, based on JsonMapper, create a SmileMapper using shared applicable format-agnostic configurations. Currently there is no way to do that, since TokenStreamFactory can not be changed either for ObjectMapper (fully immutable since 3.0, but not changeable even in 2.x), or for ObjectMapper.Builder (which is constructed passing one).

But it seems possible to allow use of

ObjectMapper.rebuildWith(TokenStreamFactory)

which could then copy subset of configuration that is shared between ObjectMapper, dropping format-specific configuration.

@cowtowncoder cowtowncoder added the 3.x Issues to be only tackled for Jackson 3.x, not 2.x label May 16, 2020
@cowtowncoder
Copy link
Member Author

Come to think of this, I think we can have parallel effort for 2.x, whereupon one can

  1. Start build process with setting of another ObjectMapper (to copy settings)
  2. Allow new SmileMapper(ObjectMapper src) as well.

As to 3.0, I suspect idea of rebuildWith(TokenStreamFactory) wouldn't work, but it'd rather have to be something like

SmileMapper.builder(TokenStreamFactory, ObjectMapper)

@cowtowncoder cowtowncoder added 2.13 and removed 3.x Issues to be only tackled for Jackson 3.x, not 2.x labels Nov 12, 2020
@cowtowncoder cowtowncoder added 2.14 and removed 2.13 labels Jul 15, 2021
@cowtowncoder cowtowncoder removed the 2.14 label Mar 2, 2024
@cowtowncoder
Copy link
Member Author

Will not pursue this, due to more format-specific constraints between mappers and TokenStreamFactory instances.

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