in camel-upgrade-recipes/src/main/java/org/apache/camel/upgrade/camel43/CamelThrottleEIPRecipe.java [55:77]
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_THROTTLE_PRIMITIVE).matches(mi, false)
&& !RecipesUtil.isCommentBeforeElement(mi, WARNING_COMMENT)) {
mi = mi.withComments(Collections.singletonList(RecipesUtil.createMultinlineComment(WARNING_COMMENT)));
getCursor().putMessage("throttle-migrated", true);
} else if (getMethodMatcher(M_THROTTLE_TIME_PERIOD_MILLIS_PRIMITIVE).matches(mi, false)) {
if (mi.getSelect() instanceof J.MethodInvocation) {
return (J.MethodInvocation) mi.getSelect();
} else {
return null;
}
}
return mi;
}
});
}