I am comparatively newbie to apache camel. I am working on route called 'Upgrade' using Java DSL. I have java bean called 'Action' which has an enum,
public enum bundle{
AAA("Monthly AAA Bundle"),
BBB("Monthly BBB Bundle");
private String upbundle;
private bundle(String upBundle) {this.upbundle = upBundle;}
private getBundle() {return upbundle;}
}
From route I want to call 'valueOf()' on enum to get BundleName. I have enum value 'AAA' in exchange header. Using 'AAA' i want to retrieve enum value i.e. 'Monthly AAA Bundle' and store it in exchange header name 'destBundleName'
I used
.setHeader("destBundleName", simple(Action.bundle.valueOf(header("bm").toString()).getBundle()))
is given me runtime error "No enum constant Action.bundle.header{bm} at java.lang.Enum.valueOf
but if i use
.setHeader("destBundleName", simple(Action.bundle.valueOf("AAA")).getBundle())) it works fine.
It means in 1st e.g. header("bm").toString() is not replacing it with String.
I can write process() or bean method which calls enum valueof & from my route i can use that bean method but Is there any way to access enum valueOf() directly from route using value from camel header as a valueOf() param.
Thank you so much for help.