I have an Enum which goes something like this:
public enum Level {
HIGH ("hi"),
MEDIUM("med"),
LOW ("lo")
;
private final String levelCode;
private Level(String levelCode) {
this.levelCode = levelCode;
}
}
This enum is element in another request class like :
public class RequestPOJO{
Level level;
int somefield1; //other instance varilables
//...... other instance varilables
}
I want to map a string field (with name levelCode) in JSON request to this enum. I'm using Jackson for serialisation. Is there any way to map this string field in request directly to this enum.