CAMEL-22894: Extract OGNL/exchange-property and function(...) Simple functions into dedicated factories#23576
Conversation
…hangeFunctionFactory Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED
…ory; add createCode invalid-OGNL test Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED
…nFactory 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:
|
|
🧪 CI tested the following changed modules:
Build reactor — dependencies compiled but only changed modules were tested (2 modules)
|
davsclaus
left a comment
There was a problem hiding this comment.
Clean extraction that continues the established CAMEL-22894 pattern. Prefix ordering is preserved correctly, the exception OGNL error message bug fix is valid, and tests cover both createFunction and createCode paths.
Optional suggestion: testCreateCodeExceptionInvalidOgnl validates the exception is thrown but doesn't assert the message content. Since the bug was specifically a wrong error message (exceptionAs vs exception), asserting the message would be a stronger regression guard.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of Claus Ibsen
Description
Continues the ongoing extraction of
SimpleFunctionExpressioninline logic into dedicatedSimpleLanguageFunctionFactoryimplementations (CAMEL-22894).This PR extracts two groups into new factories:
ExchangeFunctionFactory— OGNL/exchange-property group:${camelContext.OGNL}— CamelContext OGNL navigation${exception.OGNL}— exception OGNL navigation${exceptionAs(type).OGNL}— typed exception cast with optional OGNL (CSimple code-gen only)${exchangeProperty.name},${exchangeProperty:name},${exchangeProperty[name]}— plain property access${exchangePropertyAs(key, type)}— typed property access (CSimple code-gen only)${exchangePropertyAsIndex(key, type, index)}— indexed typed property access (CSimple code-gen only)${exchange.OGNL}— raw Exchange OGNL navigationCustomFunctionFactory— user-defined custom functions:${function(name)}— invoke registered custom function with body as input${function(name, exp)}— invoke registered custom function with explicit expression as inputAll parsing and error messages are preserved exactly from the removed inline blocks. Prefix ordering within each factory is intentional to avoid incorrect prefix matches (e.g.
exchangePropertyAsIndex(beforeexchangePropertyAs(beforeexchangeProperty).SimpleFunctionExpressiondrops from ~560 to 295 lines after this extraction.A post-review fix was also applied: the
exceptionOGNL invalid-OGNL error message increateCodewas incorrectly saying${exceptionAs(type).OGNL}instead of${exception.OGNL}(copy-paste from the branch above it). AcreateCodeinvalid-OGNL test was added to catch this class of regression.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.