This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch fix/CAMEL-24720-doc-endpoint-examples in repository https://gitbox.apache.org/repos/asf/camel.git
commit 28a2a2e443adabd15b985358a32d1443ba2f3582 Author: Claus Ibsen <[email protected]> AuthorDate: Thu Sep 17 21:10:06 2026 +0200 CAMEL-24720: camel-mapstruct - the documentation shows the mapstruct endpoint next to the type converter, with when to prefer each Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../camel/catalog/docs/mapstruct-component.adoc | 43 ++++++++++++++++++++++ .../src/main/docs/mapstruct-component.adoc | 43 ++++++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/mapstruct-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/mapstruct-component.adoc index b73bd57aa366..05b6389d0599 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/mapstruct-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/mapstruct-component.adoc @@ -92,6 +92,49 @@ YAML:: Where `MyFooDto` is a POJO that MapStruct is able to convert to/from. +=== Using the mapstruct endpoint + +The same conversion can be a step of the route with the `mapstruct` endpoint, whose path is the fully qualified +class name of the POJO to convert the message body to. This makes the mapping visible in the route, and with +`mandatory=false` a body that no mapper can convert passes through unchanged instead of failing: + +[tabs] +==== +Java:: ++ +[source,java] +---- +from("direct:foo") + .to("mapstruct:com.foo.MyFooDto") + .to("direct:process"); +---- + +XML:: ++ +[source,xml] +---- +<route> + <from uri="direct:foo"/> + <to uri="mapstruct:com.foo.MyFooDto"/> + <to uri="direct:process"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:foo + steps: + - to: + uri: mapstruct:com.foo.MyFooDto + - to: + uri: direct:process +---- +==== + NOTE: Camel does not support mapper methods defined with a `void` return type such as those used with `@MappingTarget`. WARNING: If you define multiple mapping methods for the same from / to types, then the implementation chosen by diff --git a/components/camel-mapstruct/src/main/docs/mapstruct-component.adoc b/components/camel-mapstruct/src/main/docs/mapstruct-component.adoc index b73bd57aa366..05b6389d0599 100644 --- a/components/camel-mapstruct/src/main/docs/mapstruct-component.adoc +++ b/components/camel-mapstruct/src/main/docs/mapstruct-component.adoc @@ -92,6 +92,49 @@ YAML:: Where `MyFooDto` is a POJO that MapStruct is able to convert to/from. +=== Using the mapstruct endpoint + +The same conversion can be a step of the route with the `mapstruct` endpoint, whose path is the fully qualified +class name of the POJO to convert the message body to. This makes the mapping visible in the route, and with +`mandatory=false` a body that no mapper can convert passes through unchanged instead of failing: + +[tabs] +==== +Java:: ++ +[source,java] +---- +from("direct:foo") + .to("mapstruct:com.foo.MyFooDto") + .to("direct:process"); +---- + +XML:: ++ +[source,xml] +---- +<route> + <from uri="direct:foo"/> + <to uri="mapstruct:com.foo.MyFooDto"/> + <to uri="direct:process"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:foo + steps: + - to: + uri: mapstruct:com.foo.MyFooDto + - to: + uri: direct:process +---- +==== + NOTE: Camel does not support mapper methods defined with a `void` return type such as those used with `@MappingTarget`. WARNING: If you define multiple mapping methods for the same from / to types, then the implementation chosen by
