'Jackson universal Deserializer managing IdentityReferences
Overflow Community.
I'm afraid my current problem is quite complex and I did not yet manage to find any solution by myself - so please bear with me while I give you the context.
I'm working on a large Data-Structure which contents are fetched from a (GraphQL-)Server. The responses from those requests are mapped via Jackson. I was using a custom ObjectIdResolver to fill in any already known IDs to prevent fetching of recently fetched Objects (using an internal lastFetch attribute). My problem with this approach is that I have multiple ID-Domains that have to be seperate but not by the ClassType but by a parent objects id - which I have no to acces from the static IdResolver context. (See similar Reference Question) Since its a comparibly large Structure (75+ Classes and hundreds of Attributes) I really dont want to write a custom Deserializer for each Class.
So here's my question: Is there a way of implementing a generic Deserializer that checks (if this object implements the interface 'Node' - that tells it that it contains an id/reference & lastFetch attribute) in a Map<String/*ID-Domain*/, Map<Class, String/*ID*/>> wether it exists in the specified ID-Domain and then uses this Object(Reference) instead? and then continues with the default Deserializer.
After digging for a while I fount that Jackson has a BeanDeserializer that could be used for this - right? (I am not sure if this solution would be applicable)
Now I am wondering how to implement this Deserializer to only 'find' POJO's within the same ID-Domain which are not 'too old'. I thought about using a custom ObjectIdReader but I am not certain this could solve my problem or if this solution is the best way of doing this or if the 'Lookup-Map' would work better.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
