私の目標は、jsonObject を Class に変換することです。クラスで注釈が付けられているフィールドのみを追加したい。例: json オブジェクトは 50 個のフィールドを保持します。クラスには 4 つのフィールドがあります。クラスに46の追加無視を追加せずに、正確な4フィールドのみをマップしたい。
JSON:
{
"id": "1",
"name": "John",
"Address": "Some Address 7009",
}
クラス:
public static class User {
Integer id;
String name;
public User (@JsonProperty("id")Integer id, @JsonProperty("name")String name {
this.id= id;
this.name= name;
}
....
}
ユーザー クラスにはアドレス フィールドがありません。注釈がないため、私の目標はそれを除外することです。