Polymorphic deserialization based on root tag

オープン
#537 コメント 1 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
java, xml
領域
backend

調査の方向性

エントリーポイント XmlMapper.readValue(data, MyAbstractPojo.class) から始め、@JsonTypeInfo と @JsonSubTypes が現在どのようにポリモーフィック型を選択しているかを確認します。XML のルートタグがサブタイプを選択するテストを定義し、その後、property や wrapper object を必要とせずに、実装がルートタグによるディスパッチを処理できることを検証します。

索引モデルが issue の本文から書いたものです。

説明

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:

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.

主要言語
Java
スター
636
フォーク
250
平均マージ
7時間 10分
マージ済み PR(30日)
8

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

FasterXML/jackson-dataformat-xml のほかの issue

FasterXML/jackson-dataformat-xml の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。