Here's a code sample illustrating what I find to be a surprising behavior:
//Just some interface
public interface Named {
String getName();
}
//The implementation
public class Concrete implements Named {
@Override
public String getName() {
...
}
public void setName(String name) {
...
}
}
//Make Jackson aware that Named can be deserialized as Concrete
ObjectMapper objectMapper = new ObjectMapper();
SimpleModule mod = new SimpleModule("XXXXXX");
mod.addAbstractTypeMapping(Named.class, Concrete.class);
objectMapper = objectMapper.registerModule(mod);
//Inspect the detected deserializable properties on Named
JavaType javaType = objectMapper.getTypeFactory().constructType(Named
.class);
BeanDescription desc =
objectMapper.getDeserializationConfig().introspect(javaType);
//Check to see if name is deserializable
desc.findProperties().get(0).couldDeserialize(); //It isn't?
Is it normal that DeserializationConfig says it won't be able to
deserialize the name property, despite having a concrete type registered?
--
You received this message because you are subscribed to the Google Groups
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jackson-user/78374bef-0cc0-4f3d-924a-ebaf0c272678%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.