-
Notifications
You must be signed in to change notification settings - Fork 41
Closed
Description
ConversionBodyIllegalCodeException: error in static conversion: probably is an incompatibility of signature, the expected input fields do not match with the real ones, checks the configured class.
I want to convert a primitiv short to an enum object.
.add(attribute("anEnum") .value("aShort")) .add(conversion("shortToEnum") .from("aShort").to("anEnum") .type(JMapConversion.Type.DYNAMIC) .body("return com.test.v1.Enum.get(${source});")));
The class has a get() method which returns an Enum.
public enum Enum {
NUMBER(1);
private final int value;
Enum(int value) {
this.value = value;
}
public int getValue() {
return value;
}
public static Enum get(short s){
for(Enum e: values()){
if(e.getValue() == s){
return e;
}
}
return null;
}
}
maybe a Bug?