You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've something like :
@JsonTypeInfo(use = Id.NAME, include = As.PROPERTY, property = "type")
@JsonSubTypes({@JsonSubTypes.Type(value = Mammal.class, name = "Dog"),
@JsonSubTypes.Type(value = Mammal.class, name = "Cat"),
@JsonSubTypes.Type(value = Bird.class, name = "Dodo"},
@JsonSubTypes.Type(value = Bird.class, name = "Cockatoo"})
public class Animal {
}
What I'm seeing right now is that Jackson will only recognize the Dog-to-Mammal and the Dodo-to-Bird mapping. This is because StdSubtypeResolver._collectAndResolve() only allows the same class to get registered once (due to the implementation of NamedType.equals()).
Not at all, it means that I just want to keep one issue open for same underlying problem. :-)
So I hope that #312 does get implemented eventually. But it has not yet been implemented.
But given that it has not yet been fixed, you may have to write your own deserializer in the meantime (even if implemented, it'd go at earliest in 2.5.0, so it also depends on timing).
I've something like :
@JsonTypeInfo(use = Id.NAME, include = As.PROPERTY, property = "type")
@JsonSubTypes({@JsonSubTypes.Type(value = Mammal.class, name = "Dog"),
@JsonSubTypes.Type(value = Mammal.class, name = "Cat"),
@JsonSubTypes.Type(value = Bird.class, name = "Dodo"},
@JsonSubTypes.Type(value = Bird.class, name = "Cockatoo"})
public class Animal {
}
What I'm seeing right now is that Jackson will only recognize the Dog-to-Mammal and the Dodo-to-Bird mapping. This is because StdSubtypeResolver._collectAndResolve() only allows the same class to get registered once (due to the implementation of NamedType.equals()).
Based on the question at http://stackoverflow.com/questions/18394819/jackson-polymorphism-how-to-map-multiple-subtypes-to-the-same-class following StaxMan advice to create an issue.
The text was updated successfully, but these errors were encountered: