Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
さまざまなタイプのオブジェクトの配列をシリアル化していますが、それらはすべてスーパータイプBasicClassです。そのようにシリアル化すると:
BasicClass
@JsonProperty public BasicClass[] getReferences() { return this.refs; }
また、すべてのサブタイプの JSON プロパティをシリアル化します。スーパータイプのプロパティのみをシリアル化するにはどうすればよいですか?
@JsonSerialize注釈を使用する必要があります。または のいずれかとしてTyping値を指定できます。あなたの場合、特定のサブクラスが表示されるまで実行時まで待つのではなく、型を使用したいと考えています。dynamicstaticstatic
@JsonSerialize
Typing
dynamic
static