I have this code for the enum on the model:
public enum StatusEnum {
GOODSTANDING("Goodstanding/Inforce"),
GRACE("Grace"),
LAPSE("Lapse");
private String value;
StatusEnum(String value) {
this.value = value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static StatusEnum getEnum(String valor) {
return StatusEnum.GOODSTANDING.toString().equals(valor) ? StatusEnum.GOODSTANDING
: (StatusEnum.GRACE.toString().equals(valor) ? StatusEnum.GRACE
: (StatusEnum.GRACE.toString().equals(valor) ? StatusEnum.GRACE : StatusEnum.LAPSE));
}
public String toValue() {
return StatusEnum.GOODSTANDING.toString().equals(this.value) ? StatusEnum.GOODSTANDING.toString()
: (StatusEnum.GRACE.toString().equals(this.value) ? StatusEnum.GRACE.toString()
: StatusEnum.LAPSE.toString());
}
}
I can successfully run a test to parse the string like this:
ObjectMapper mapper = new ObjectMapper();
PolicyPremium.StatusEnum s1 = mapper.readValue("\"Goodstanding/Inforce\"", PolicyPremium.StatusEnum.class);
System.out.println(s1);
So I know is working fine outside of the engine with this error:
Caused by: spinjar.com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not construct instance of com.northstar.slxclient.client.model.PolicyPremium$StatusEnum from String value 'Goodstanding/Inforce': value not one of declared Enum instance names: [GRACE, GOODSTANDING, LAPSE]
at [Source: N/A; line: -1, column: -1] (through reference chain: java.util.ArrayList[0]->com.northstar.slxclient.client.model.Policy["currentPremium"]->com.northstar.slxclient.client.model.PolicyPremium["status"])