davsclaus opened a new pull request, #24031:
URL: https://github.com/apache/camel/pull/24031
## Summary
- Add a new `core/camel-java-io` module that generates fluent Java DSL
source code from Camel model definitions
- Enables full-circle DSL transformation: XML/YAML → Model → Java DSL (and
back via existing parsers)
- Follows the same code-generation pattern as existing `camel-xml-io` and
`camel-yaml-io` modules
## Architecture
| Layer | XML | YAML | **Java DSL (new)** |
|-------|-----|------|-------------------|
| Module | `core/camel-xml-io` | `core/camel-yaml-io` | `core/camel-java-io`
|
| Generated class | `ModelWriter` | `YamlModelWriter` | `JavaDslModelWriter`
|
| Support class | `BaseWriter` | `YamlModelWriterSupport` |
`JavaDslModelWriterSupport` |
| Package | `o.a.c.xml.out` | `o.a.c.yaml.out` | `o.a.c.java.out` |
| Mojo | `XmlModelWriterGeneratorMojo` | `YamlModelWriterGeneratorMojo` |
`JavaDslModelWriterGeneratorMojo` |
| Template | `model-writer.vm` | `model-yaml-writer.vm` |
`model-java-dsl-writer.vm` |
## Example Output
```java
from("direct:start")
.routeId("myRoute")
.choice()
.when(simple("${header.type} == 'a'"))
.to("mock:a")
.when(simple("${header.type} == 'b'"))
.to("mock:b")
.otherwise()
.to("mock:other")
.end()
.to("mock:result");
```
## New Files
- `JavaDslModelWriterGeneratorMojo.java` — Mojo extending
`ModelWriterGeneratorMojo` for code generation
- `model-java-dsl-writer.vm` — Velocity template producing the generated
`JavaDslModelWriter` class
- `core/camel-java-io/` — New module with `JavaDslModelWriterSupport` (DSL
rendering helpers) and generated `JavaDslModelWriter`
- Test suite covering simple routes, choice/when/otherwise, filter, split,
setHeader, setVariable, transform, wireTap, multicast, toD, removeHeader,
multiple expression languages, and writer reusability
## Test Plan
- [x] Unit tests for all major EIP patterns (12 tests)
- [x] Expected output files for exact string comparison
- [x] Writer reusability test (same instance, multiple routes)
- [x] Full root build passes (`mvn clean install -DskipTests`)
_Claude Code on behalf of Claus Ibsen_
🤖 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]