-
-
Notifications
You must be signed in to change notification settings - Fork 98
Description
I recently used the nitrite dependency in my project. I cannot use the Jackson-Mapper because I have store data that is not JSON-serializable.
I tried to write my own mapper from Object to the Document class, which was quite easy - yet the interface NitriteMapper requires me to implement a toJson-method and a parse-method, which would have forced me to add the complete JSON-Serialization/Deserialization (coming up with almost the same code as JacksonMapper).
Extending the JacksonMapper also failed because I would have inserted some configurable Features to the Objectmapper (for correctly serializing/deserializing the nonserializable data), yet ObjectMapper is called as first Method in JacksonMapper so I cannot pass any arguments to it.
So I came up with copying the JacksonMapper and changing the parts that are not common. Yet this also did not work because the naive ObjectMapper cannot handle Maps of typed Objects correctly (these always get Maps of Maps after the round trip) and the configured ObjectMapper (with defaultTyping) violates some internals of Nitrite.
After some research, I think that NitriteMapper has two idependent responsibilities:
- converting Objects to Documents and vice versa
- converting Objects to JSON and vice versa
Can these both Interface not be separate such that a NitriteMapper does only implement the Object <=> Document conversions and another interface handles the Object <=> JSON conversions.
What do you think about this?
Metadata
Metadata
Assignees
Labels
Type
Projects
Status