我使用JAVA 1.6和Jackson 1.9.9,我有一个enum
public enum Event {
FORGOT_PASSWORD("forgot password");
private final String value;
private Event(final String description) {
this.value = description;
}
@JsonValue
final String value() {
return this.value;
}
}
我已经添加了一个@JsonValue,这似乎做的工作,它序列化对象:
{"event":"forgot password"}
但当我尝试反序列化时,我得到
Caused by: org.codehaus.jackson.map.JsonMappingException: Can not construct instance of com.globalrelay.gas.appsjson.authportal.Event from String value 'forgot password': value not one of declared Enum instance names
我错过了什么?