-
I have the following generic class where i can't add the JsonTypeInfo for public class LockingResponse<E> {
private ReadOnlyValues<E> originalValues;
private E values;
}
public class ReadOnlyValues<E> {
private String hash;
@JsonTypeInfo(use = JsonTypeInfo.Id.MINIMAL_CLASS)
private E values;
} As the type of Does someone have a better idea or knows how i can access the other property from my custom TypeDeserializer? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
As general note, combination of generic and polymorphic types is not (and basically, can not be) supported.
So what it all comes down to is that your use case would require use of custom deserializer that handles full value to which access is needed, |
Beta Was this translation helpful? Give feedback.
Thanks for your answer.
I also tried building a custom Deserializer but didn't work out for me as i couldn't figure out how to use the ObjectMapper with a generic type.
Solution/workaround for me was to build a extra class which just extends the generic class (see following example).