FasterXML / FasterXML/jackson-dataformat-xml

Polymorphic deserialization based on root tag

Aperta
#537 1 commento 2 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
631
Fork
246
Merge medio
7g 9h
PR unite (30g)
13

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.