You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2026/01/26 13:01:47 UTC
(camel) 09/41: (chores): modernize instanceof checks in camel-stitch
This is an automated email from the ASF dual-hosted git repository.
orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 1f31ef5c286c42aae48efe5e6574c005faa0ac01
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Mon Jan 26 10:43:12 2026 +0000
(chores): modernize instanceof checks in camel-stitch
---
.../stitch/operations/StitchProducerOperations.java | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/components/camel-stitch/src/main/java/org/apache/camel/component/stitch/operations/StitchProducerOperations.java b/components/camel-stitch/src/main/java/org/apache/camel/component/stitch/operations/StitchProducerOperations.java
index 1c2ab633740a..5c35457d7e68 100644
--- a/components/camel-stitch/src/main/java/org/apache/camel/component/stitch/operations/StitchProducerOperations.java
+++ b/components/camel-stitch/src/main/java/org/apache/camel/component/stitch/operations/StitchProducerOperations.java
@@ -118,19 +118,19 @@ public class StitchProducerOperations {
final Collection<StitchMessage> stitchMessages = new LinkedList<>();
inputData.forEach(data -> {
- if (data instanceof StitchMessage) {
- stitchMessages.add((StitchMessage) data);
+ if (data instanceof StitchMessage stitchmessage) {
+ stitchMessages.add(stitchmessage);
} else if (data instanceof Map) {
stitchMessages.add(StitchMessage.fromMap(ObjectHelper.cast(Map.class, data)).build());
- } else if (data instanceof StitchRequestBody) {
- stitchMessages.addAll(((StitchRequestBody) data).getMessages());
- } else if (data instanceof Message) {
- final Message camelNestedMessage = (Message) data;
+ } else if (data instanceof StitchRequestBody stitchrequestbody) {
+ stitchMessages.addAll(stitchrequestbody.getMessages());
+ } else if (data instanceof Message camelNestedMessage2) {
+ final Message camelNestedMessage = camelNestedMessage2;
// set all the headers from parent message
camelNestedMessage.setHeaders(message.getHeaders());
stitchMessages.addAll(createStitchRequestBody(camelNestedMessage).getMessages());
- } else if (data instanceof Exchange) {
- final Message camelNestedMessage = ((Exchange) data).getMessage();
+ } else if (data instanceof Exchange exchange) {
+ final Message camelNestedMessage = (exchange).getMessage();
// set all the headers from parent message
camelNestedMessage.setHeaders(message.getHeaders());
stitchMessages.addAll(createStitchRequestBody(camelNestedMessage).getMessages());