in camel-upgrade-recipes/src/main/java/org/apache/camel/upgrade/camel42/CamelSagaRecipe.java [54:75]
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 ((getMethodMatcher(M_NEW_SAGA).matches(mi, false)
|| getMethodMatcher(M_SAGA_COORDINATOR_COMPENSATE).matches(mi, false)
|| getMethodMatcher(M_SAGA_COORDINATOR_COMPLETE).matches(mi, false))
&& RecipesUtil.methodInvocationAreArgumentEmpty(mi)) {
J.Identifier type
= RecipesUtil.createIdentifier(Space.EMPTY, "Exchange", "import org.apache.camel.Exchange");
J.TypeCast cp = (J.TypeCast) RecipesUtil.createTypeCast(type, RecipesUtil.createNullExpression());
mi = mi.withArguments(Collections.singletonList(cp.withComments(
Collections.singletonList(RecipesUtil.createMultinlineComment("Exchange parameter was added.")))));
}
return mi;
}
});
}