非字符串映射键我有机管局地图,看起来像这样:反序列化与杰克逊
public class VerbResult {
@JsonProperty("similarVerbs")
private Map<Verb, List<Verb>> similarVerbs;
}
我动词类看起来是这样的:
public class Verb extends Word {
@JsonCreator
public Verb(@JsonProperty("start") int start, @JsonProperty("length") int length,
@JsonProperty("type") String type, @JsonProperty("value") VerbInfo value) {
super(length, length, type, value);
}
//...
}
我想序列化和反序列化的情况下,我VerbResult类,但当我做我得到这个错误:Can not find a (Map) Key deserializer for type [simple type, class my.package.Verb]
我在网上读到,你需要告诉杰克逊如何反序列化映射键,但我没有找到任何信息解释如何去做这件事。动词类需要在地图之外进行序列化和反序列化,因此任何解决方案都应该保留此功能。
谢谢你的帮助。
作品有你读http://stackoverflow.com/questions/6371092/can-not-find-a-map-key-deserializer-for-type -simple-type-class-com-comcast-i?他的情况看起来与你的一见钟情。 – fvu
是的,我已经阅读过,但实际上我没有找到答案。我怎样才能使用模块来解决这个问题? – Max