Skip to content

CAMEL-22894: extract math and string Simple functions into dedicated factories#23388

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

CAMEL-22894: extract math and string Simple functions into dedicated factories#23388
davsclaus merged 1 commit into
apache:mainfrom
ammachado:CAMEL-22894

Conversation

@ammachado
Copy link
Copy Markdown
Contributor

@ammachado ammachado commented May 20, 2026

Description

Extract Simple language math and string functions from the monolithic SimpleFunctionExpression into dedicated SimpleLanguageFunctionFactory implementations, continuing the refactoring started in #23382.

  • MathFunctionFactory: handles abs, floor, ceil, sum, max, min, average (both expression and CSimple code-gen paths)
  • StringFunctionFactory: handles replace, substring, substringBefore, substringAfter, substringBetween, contains, trim, val, capitalize, pad, concat, quote, safeQuote, unquote, uppercase, lowercase, length, size, normalizeWhitespace (both paths)
  • Consolidates the full codeSplitSafe implementation into SimpleFunctionHelper, deprecating the delegation stub on SimpleFunctionExpression
  • Both factories are registered in SimpleFunctionDispatcher.BUILT_INS
  • Reduces SimpleFunctionExpression from ~3600 to ~2300 lines

Documentation fixes (simple-language.adoc)

  • Clarified substring(num1,num2) and substring(num1,num2,exp) table descriptions: explicitly states that num1 clips from the beginning and num2 clips from the ending.
  • Fixed mismatched backtick/parenthesis in contains(text), contains(exp,text), and iif(predicate,trueExp,falseExp) table entries.
  • Added missing closing parentheses in substringBetween(after,before) and substringBetween(exp,after,before) table entries.
  • Fixed isAlpha() and isAlpha(exp) descriptions: changed "numeric value" to "alphabetic value".

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.

🤖 Generated with Claude Code

@ammachado ammachado force-pushed the CAMEL-22894 branch 3 times, most recently from a2e589f to 07fc057 Compare May 20, 2026 21:18
…factories

Extract abs/floor/ceil/sum/max/min/average into MathFunctionFactory and
replace/substring/substringBefore/substringAfter/substringBetween/contains/
trim/val/capitalize/pad/concat/quote/safeQuote/unquote/uppercase/lowercase/
length/size/normalizeWhitespace into StringFunctionFactory.

Consolidates the full codeSplitSafe implementation into SimpleFunctionHelper
(deprecating the delegation stub on SimpleFunctionExpression). Reduces
SimpleFunctionExpression from ~3600 to ~2300 lines.

Also fix a few typos present on the Simple language documentation.

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 20, 2026 22:15
@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.

@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

@davsclaus davsclaus merged commit 2972b41 into apache:main May 21, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants