-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add common DockerObject
parent to every model class
#1635
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
Conversation
public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { | ||
JsonNode jsonNode = p.readValueAsTree(); | ||
|
||
Object deserializedObject = originalMapper.treeToValue(jsonNode, beanDescription.getBeanClass()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jackson 2.13 will help here with method DeserializationContext.readTreeAsValue(JsonNode, Class)
, but alas not yet available. But there is DeserializationContext.readTree(JsonParser)
which has some small benefits over going through JsonParser
-- probably not much difference here just minor improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cowtowncoder thanks for having a look!
I tried DeserializationContext.readTree(JsonParser)
but ended up getting a recursive problem 😅 Hence the "originalMapper" workaround.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. Odd... would be interested in details if you have any (just to see if there's something to fix), but makes sense to skip in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As now I have your aura around, let me try it again and report back :)
Can also share how to try it, without even having Docker running (a.k.a. in memory)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, okay, I am stupid :D I confused readTree
with readValue
😅
readValue
gives a recursive problem, while JsonNode jsonNode = ctxt.readTree(p);
(previous line) works just fine, thanks!
No description provided.