question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Refactor `StackItem` to use Jackson annotations for deserializing subclasses

See original GitHub issue

The StackItem class currently uses a custom deserializer to deserialize its various subclasses. See TransactionAttribute as an example on how to do this.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mialbucommented, Jun 24, 2020

I tried to do this and it works for all StackItemTypes except for Maps. For the StackItemType Map, a custom Key deserialiser is needed.

Reason for this: In a Map-StackItem the value is of type Map<StackItem, StackItem>, hence the key-value pair are both StackItems. Using Jackson annotations, however, by default the keys of a Map are deserialised as Strings. This leads to an InvalidDefinitionException that asks for a (Map) Key deserialiser.

0reactions
mialbucommented, Jul 6, 2020

This was merged. I’ll close it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inheritance in Jackson | Baeldung
This tutorial will demonstrate how to handle inclusion of subtype metadata and ignoring properties inherited from superclasses with Jackson.
Read more >
Jackon JSON: Polymorphic deseralization when subclasses ...
I'm trying to do some polymorphic deseralization of JSON using Jackson, however the list of subclasses is unknown at compile time, so I...
Read more >
Jackson Annotations for JSON (Part 3): Deserialization - DZone
The @JsonSetter annotation tells Jackson to deserialize the JSON into Java object using the name given in the setter method. Use this annotation...
Read more >
SUSE-SU-2022:1678-1: important: Security update for jackson ...
(bsc#1182481) Non security fixes: jackson-annotations - update from ... thrown for mismatched subclass deserialization + Add convenience ...
Read more >
Polymorphism and Inheritance with Jackson - OctoPerf
Learn how to serialize and deserialize polymorphic object trees with Jackson Json Databind. Using practical code examples to make it easy to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found