FasterXML / FasterXML/jackson-dataformat-xml

Polymorphic deserialization based on root tag

Offen
#537 1 Kommentar 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Java
Sterne
631
Forks
246
Ø Merge
7 T. 9 Std.
Gemergte PRs (30 T.)
13

Beschreibung

Hello!
I am not sure if this is a help or a feature request. I scoured google/SO trying to dynamically select target class based on the root tag. I expected the usage to be something like this:
```java
xmlMapper.readValue(data, MyAbstractPojo.class)
```
where `MyAbstractPojo` is annotated with `@JsonTypeInfo` and `@JsonSubTypes` to configure type selection. However, root tag is not a property, not an external property and not a wrapper object, which means it's not helpful to use those. Even if you use `DEDUCTION` as a mechanism, only property names are considered, root tag is again ignored.

So I wanted to ask whether I have missed something obvious, and if I did not, consider implementing this feature for the XML module.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.