Skip to content

CAMEL-22894: Extract bean: Simple function into BeanFunctionFactory#23569

Merged
davsclaus merged 1 commit into
apache:mainfrom
ammachado:CAMEL-22894
May 27, 2026
Merged

CAMEL-22894: Extract bean: Simple function into BeanFunctionFactory#23569
davsclaus merged 1 commit into
apache:mainfrom
ammachado:CAMEL-22894

Conversation

@ammachado
Copy link
Copy Markdown
Contributor

Description

Continues the CAMEL-22894 series of SimpleFunctionExpression refactoring (follows #23566).

The bean: function previously had its ref/method/scope parsing logic duplicated in two private methods inside SimpleFunctionExpression: one for the runtime expression path and one for the CSimple code-generation path. This PR extracts both into a new BeanFunctionFactory with a shared parseBeanRemainder helper, eliminating the duplication and reducing SimpleFunctionExpression by ~100 more lines.

SimpleFunctionExpression is now ~560 lines, down from the original 3,713.

Claude Code on behalf of Adriano Machado

Target

  • I checked that the commit is targeting the correct branch (Camel 4 uses the main branch)

Tracking

  • If this is a large change, bug fix, or code improvement, I checked there is a JIRA issue filed for the change (usually before you start working on it).

Apache Camel coding standards and style

  • I checked that each commit in the pull request has a meaningful subject line and body.
  • I have run mvn clean install -DskipTests locally from root folder and I have committed all auto-generated changes.

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
@ammachado ammachado marked this pull request as ready for review May 27, 2026 16:23
@github-actions github-actions Bot added the core label May 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

Copy link
Copy Markdown
Contributor

@davsclaus davsclaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@davsclaus davsclaus merged commit f18c1e0 into apache:main May 27, 2026
6 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • core/camel-core-languages
  • core/camel-core

ℹ️ Dependent modules were not tested because the total number of affected modules exceeded the threshold (50). Use the test-dependents label to force testing all dependents.

⚠️ Some tests are disabled on GitHub Actions (@DisabledIfSystemProperty(named = "ci.env.name")) and require manual verification:

  • core/camel-core: 2 test(s) disabled on GitHub Actions
Build reactor — dependencies compiled but only changed modules were tested (2 modules)
  • Camel :: Core
  • Camel :: Core Languages

⚙️ View full build and test results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants