CAMEL-22894: Extract jq/jsonpath/xpath/simpleJsonpath Simple functions into QueryLanguageFunctionFactory#23566
Conversation
…s into QueryLanguageFunctionFactory Also drops the dead parts.length > 2 guard in PropertiesFunctionFactory.createCode() noted in the PR apache#23544 review (split with limit 2 can never exceed 2 elements). 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, well-executed continuation of the CAMEL-22894 refactoring series. Verified behavioral equivalence of the extracted QueryLanguageFunctionFactory against the removed createSimpleCustomLanguage() method — logic, error messages, and the distinct simpleJsonpath handling are all preserved.
The ordering change (query language functions now resolve via SimpleFunctionDispatcher.tryCreateBuiltIn() instead of a dedicated call earlier in doCreateSimpleExpression) is safe — no intermediate handler matches jq(/jsonpath(/xpath(/simpleJsonpath( prefixes.
The dead-code removal in PropertiesFunctionFactory.createCode() is correct (split(":", 2) guarantees at most 2 elements).
Tests cover xpath evaluation, expression creation for languages not on the core classpath, error cases, and createCode returning null. Existing integration tests in SimpleTest (lines 3812–3833) exercise simpleJsonpath end-to-end.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Description
Continues the CAMEL-22894 series of
SimpleFunctionExpressionrefactoring.This PR extracts the four embedded-language functions (
jq,jsonpath,xpath,simpleJsonpath) that previously lived inline inSimpleFunctionExpression.createSimpleCustomLanguage()into a new dedicatedQueryLanguageFunctionFactory. The factory is registered inSimpleFunctionDispatcher.BUILT_INSalongside the factories introduced in the prior PRs (#23263, #23382, #23388, #23432, #23445, #23544).Also fixes a minor dead-code issue noted in the #23544 review:
PropertiesFunctionFactory.createCode()had aparts.length > 2guard that can never be true because the precedingsplit(":", 2)call limits the result to at most 2 elements.SimpleFunctionExpressionis now ~664 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.