Description
(and make ObjectMapper
truly immutable)
One of on-going challenges with Jackson has been mutability of ObjectMapper
.
Although it is documented as "config-then-use", users often struggle in figuring out what kinds of changes are allowed. Fundamentally it is also unfortunate that API can not prevent relatively common mistake of trying to re-configure an instance that has already been used.
It would seem like relatively easy way to allow configurability but:
- Allow basic use of "just create ObjectMapper instance and go"
- Make
ObjectMapper
truly immutable
and this could be achieved by the addition of a "Builder" class.
As usual, it should be possible to both:
- Create builder statically (
ObjectMapper.builder()
? or.build()
?) - Create builder from an existing mapper, starting with its settings (
mapper.rebuild()
?)
Going forward, perhaps Builder instance should actually be java.io.Serializable
?
This might even provide a way to efficiently pass central configuration in distributed systems.
Note, however, that such settings could not pass settings modules change... which actually leads to the big question: how would modules make their changes?
... I will file another RFE for module aspects, then.