polymorphism - Jackson deserialization of polymorphic types -


i've seen example of jackson deserialization @jsontypeinfo, is:

@jsontypeinfo(     use = jsontypeinfo.id.name,     include = jsontypeinfo.as.property,     property = "type") @jsonsubtypes({     @jsonsubtypes.type(value = cat.class, name = "cat"),     @jsonsubtypes.type(value = dog.class, name = "dog")}) public class animal {...} 

i've tried , works fine. now, problem in example classes cat , dog referenced animal, want avoid. there way move type binding class animal , still have deserialization work? thanks

i found answer here: http://jira.codehaus.org/browse/jackson-654. use:

mapper.registersubtypes(cat.class, dog.class); 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -