FasterXML / FasterXML/jackson-dataformat-xml

Polymorphic deserialization based on root tag

Ouverte
#537 1 commentaire 2 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Java
Étoiles
631
Forks
246
Merge moyen
7 j 9 h
PR mergées (30 j)
13

Description

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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.