I've added the @JsonAnySetter
annotation to addProperty
method
Map<MyEnum, String> mymap = new EnumMap<>(MyEnum.class);
@JsonAnySetter
public void addProperty(MyEnum key, Object value) {
mymap.put(key, value);
}
but while deserializing I'm getting the below error
com.fasterxml.jackson.databind.JsonMappingException: Invalid 'any-setter' annotation on method 'addProperty()': first argument not of type String or Object, but java.lang.Enum
If I change the map to simple HashMap with key of type String then it works fine.
Could someone please let me know what nneds to be done for deserializing to EnumMap