CAMEL-22894: Extract bean: Simple function into BeanFunctionFactory#23569
Conversation
Removes the duplicate ref/method/scope parsing that existed in both the runtime and code-generation paths of SimpleFunctionExpression, consolidating it into a single private helper in BeanFunctionFactory. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
davsclaus
left a comment
There was a problem hiding this comment.
Clean extraction following the established CAMEL-22894 pattern. Verified behavioral equivalence: createFunction preserves the same Language.createExpression() call with identical properties layout, parseBeanRemainder() correctly handles all three syntaxes (dot, double-colon, query-string) including the ( guard for parameter declarations, and the type: class resolution stays in createFunction only.
Ordering change is safe — bean: was the last check before tryCreateBuiltIn(), now it's the last item in the BUILT_INS list.
Minor improvement: createCode now correctly handles the scope != null && method == null case that was silently ignored in the original.
Tests cover all syntax variants, createCode branches, and unrecognized input.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
|
🧪 CI tested the following changed modules:
Build reactor — dependencies compiled but only changed modules were tested (2 modules)
|
Description
Continues the CAMEL-22894 series of
SimpleFunctionExpressionrefactoring (follows #23566).The
bean:function previously had its ref/method/scope parsing logic duplicated in two private methods insideSimpleFunctionExpression: one for the runtime expression path and one for the CSimple code-generation path. This PR extracts both into a newBeanFunctionFactorywith a sharedparseBeanRemainderhelper, eliminating the duplication and reducingSimpleFunctionExpressionby ~100 more lines.SimpleFunctionExpressionis now ~560 lines, down from the original 3,713.Claude Code on behalf of Adriano Machado
Target
mainbranch)Tracking
Apache Camel coding standards and style
mvn clean install -DskipTestslocally from root folder and I have committed all auto-generated changes.