davsclaus opened a new pull request, #28444:
URL: https://github.com/apache/camel/pull/28444

   ## Description
   
   [CAMEL-26297](https://issues.apache.org/jira/browse/CAMEL-26297). This PR is 
stacked on #28443 (CAMEL-26296), which declares the options of the languages. 
Only the second commit belongs to this PR.
   
   Languages had no generated property configurer, so camel-main bound 
`camel.language.<name>.<option>` by reflection.
   
   ### Changes
   
   - **Plugin:** `PackageLanguageMojo` generates a `<Language>Configurer` for 
all 29 languages from their `@Metadata` options. The 20 languages without 
options get an empty one.
     - The configurer is registered as 
`META-INF/services/org/apache/camel/configurer/<name>-language`, the way data 
formats are registered as `<name>-dataformat`.
     - `generatePropertyConfigurer` moves from `PackageDataFormatMojo` up to 
`AbstractGeneratorMojo`, so both share it.
   - **camel-main:** finds the configurer of `camel.language.<name>.*` and 
`camel.dataformat.<name>.*` by that name.
     - Before, `MainHelper` looked up the full class name, and 
`PropertyConfigurerHelper` derived a name from the class. Neither works for 
most languages: `JsonPathLanguage` derives `json-path-language`, 
`XPathLanguage` derives `x-path-language`, `TypeSafeAiLanguage` derives 
`type-safe-ai-language`.
     - Data formats whose class doesn't derive their name were also bound by 
reflection in camel-main, for example `JacksonXMLDataFormat` (`jackson-xml` vs 
`jacksonXml`).
     - A configurer found by name is only used for the type it was generated 
for (`<target class>Configurer`). A custom bean registered under a data 
format's or language's name is still bound as before.
   
   Binding through Spring Boot happens in the camel-spring-boot starters and is 
not changed here.
   
   ### Tests
   
   - `PackageLanguageMojoTest`: the generated configurer sets and gets the 
options, and a language without options gets an empty configurer.
   - `MainConfigurerByNameTest`:
     - a language and a data format whose options have no setter are set by 
their configurer, found by name;
     - a bean of another type under the configurer's name is bound by 
reflection.
   - `JsonPathOptionsTest`: the generated `jsonpath-language` configurer is 
resolved by name and binds `options` and `writeAsString` with reflection 
switched off.
   - camel-main: all 308 tests pass.
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to