in camel-upgrade-recipes/src/main/java/org/apache/camel/upgrade/camel40/java/CamelEIPRecipe.java [40:57]
public TreeVisitor<?, ExecutionContext> getVisitor() {
return RecipesUtil.newVisitor(new AbstractCamelJavaVisitor() {
@Override
protected J.MethodInvocation doVisitMethodInvocation(J.MethodInvocation method, ExecutionContext context) {
J.MethodInvocation mi = super.doVisitMethodInvocation(method, context);
if (mi.getSimpleName().equals("inOut") || mi.getSimpleName().equals("inOnly")) {
String name = mi.getSimpleName().substring(0, 1).toUpperCase() + mi.getSimpleName().substring(1);
mi = mi.withName(mi.getName().withSimpleName("setExchangePattern(ExchangePattern." + name + ").to"));
doAfterVisit(new AddImport<>("org.apache.camel.ExchangePattern", null, false));
}
return mi;
}
});
}