問題のクラス/フィールドでJackson Mixinsを使用して@JsonDeserialize(using=CostumDeserializer.class)
注釈を偽装することができます。 次に、指定されたデシリアライザクラスでインスタンスを作成しようとすることができます。
// I'm not sure whether annotations (@JsonTypeInfo) on class level are supported as well to allow the polymorphistic type decision.
abstract class MixIn {
// make constructor usable if available
MixIn(@JsonProperty("id") int a, @JsonProperty("name") String b) { }
@JsonDeserialize(using=CostumDeserializer.class) abstract TypeX getTypeX();
}
そして、あなたはこの
objectMapper.addMixIn(TypeXContainer.class, MixIn.class);
Doksのようにそれを使用することができます:http://wiki.fasterxml.com/JacksonMixInAnnotations