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/27 08:52:54 UTC

(camel) branch main updated (dfc9cf2eacfd -> 94b884989c29)

This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


    from dfc9cf2eacfd chore(deps): Bump google-cloud-functions-version from 2.72.0 to 2.74.0 (#21084)
     new 2c901e0af000 (chores): modernize instanceof checks in camel-mock
     new a97bcab119c3 (chores): modernize instanceof checks in camel-jbang-core
     new e4336ed75f35 (chores): modernize instanceof checks in camel-ibm-watsonx-ai
     new 68105d9bcc59 (chores): modernize instanceof checks in camel-telegram
     new 23e19fbf2564 (chores): modernize instanceof checks in camel-docling
     new bbec894b9059 (chores): modernize instanceof checks in camel-google-vertexai
     new 0f1586b64660 (chores): modernize instanceof checks in camel-langchain4j-agent-api
     new a5cc193ed229 (chores): modernize instanceof checks in camel-aws2-s3-vectors
     new 7305a93f9065 (chores): modernize instanceof checks in camel-stripe
     new 041f89da9029 (chores): modernize instanceof checks in camel-test-junit6
     new 60477adf5baf (chores): modernize instanceof checks in camel-package-maven-plugin
     new 0201638cde12 (chores): modernize instanceof checks in camel-neo4j
     new 6424bfbacaf9 (chores): modernize instanceof checks in camel-spring-ai-chat
     new 4eb82762c629 (chores): modernize instanceof checks in camel-spring-ai-embeddings
     new 8ae89f39d5ac (chores): modernize instanceof checks in camel-spring-ai-vector-store
     new d58b64ab2252 (chores): modernize instanceof checks in camel-aws-bedrock
     new 0b3b76657517 (chores): modernize instanceof checks in camel-hashicorp-vault
     new fea56e87e351 (chores): modernize instanceof checks in camel-as2-api
     new bdc927267b0e (chores): modernize instanceof checks in camel-keycloak
     new 8924189aaf38 (chores): modernize instanceof checks in camel-pqc
     new 28dc623f6cd9 (chores): modernize instanceof checks in camel-milo
     new 94b884989c29 (chores): modernize instanceof checks in camel-aws2-s3

The 22 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/component/docling/DoclingProducer.java   | 29 +++++++++-----------
 .../component/langchain4j/agent/api/Agent.java     |  4 +--
 .../camel/component/neo4j/Neo4jProducer.java       |  4 +--
 .../component/as2/api/AS2ServerConnection.java     |  4 +--
 .../aws2/bedrock/runtime/BedrockProducer.java      | 16 +++++------
 .../aws2/s3vectors/AWS2S3VectorsProducer.java      | 24 +++++++---------
 .../camel/component/aws2/s3/AWS2S3Producer.java    | 28 +++++++++----------
 .../google/vertexai/GoogleVertexAIProducer.java    |  3 +-
 .../vault/HashicorpVaultReloadTriggerTask.java     |  4 +--
 .../ai/handler/AbstractWatsonxAiHandler.java       | 16 +++++------
 .../ibm/watsonx/ai/handler/DeploymentHandler.java  |  3 +-
 .../ibm/watsonx/ai/handler/ForecastHandler.java    |  3 +-
 .../ibm/watsonx/ai/handler/ToolHandler.java        |  4 +--
 .../camel/component/keycloak/KeycloakProducer.java | 32 +++++++++++-----------
 .../security/KeycloakTokenIntrospector.java        | 14 +++++-----
 .../camel/component/milo/KeyStoreLoader.java       |  4 +--
 .../org/apache/camel/component/milo/NodeIds.java   | 16 +++++------
 .../milo/client/MiloClientConnection.java          | 16 +++++------
 .../milo/client/internal/SubscriptionManager.java  |  3 +-
 .../component/milo/server/MiloServerComponent.java |  4 +--
 .../milo/server/internal/CamelServerItem.java      |  8 +++---
 .../camel/component/mock/MockValueBuilder.java     |  8 +++---
 .../AwsSecretsManagerKeyLifecycleManager.java      |  8 +++---
 .../lifecycle/FileBasedKeyLifecycleManager.java    |  8 +++---
 .../HashicorpVaultKeyLifecycleManager.java         |  8 +++---
 .../springai/chat/SpringAiChatProducer.java        | 15 +++++-----
 .../chat/rag/SpringAiRagAggregatorStrategy.java    |  8 +++---
 .../embeddings/SpringAiEmbeddingsProducer.java     |  4 +--
 .../vectorstore/SpringAiVectorStoreProducer.java   | 30 ++++++++++----------
 .../camel/component/stripe/StripeProducer.java     |  3 +-
 .../camel/component/telegram/model/PaidMedia.java  |  6 ++--
 .../model/payments/RevenueWithdrawalState.java     |  6 ++--
 .../model/payments/TransactionPartner.java         | 14 +++++-----
 .../test/junit6/params/ParameterizedExtension.java |  4 +--
 .../camel/dsl/jbang/core/commands/Explain.java     |  8 +++---
 .../packaging/UpdateHeaderImportantHelper.java     |  4 +--
 36 files changed, 178 insertions(+), 195 deletions(-)


(camel) 09/22: (chores): modernize instanceof checks in camel-stripe

Posted by or...@apache.org.
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 7305a93f906509eefb4f88f279946e8e19eee37d
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 05:56:05 2026 +0000

    (chores): modernize instanceof checks in camel-stripe
---
 .../main/java/org/apache/camel/component/stripe/StripeProducer.java    | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/components/camel-stripe/src/main/java/org/apache/camel/component/stripe/StripeProducer.java b/components/camel-stripe/src/main/java/org/apache/camel/component/stripe/StripeProducer.java
index 98c8ebc6fc47..d88a5649c8fc 100644
--- a/components/camel-stripe/src/main/java/org/apache/camel/component/stripe/StripeProducer.java
+++ b/components/camel-stripe/src/main/java/org/apache/camel/component/stripe/StripeProducer.java
@@ -84,8 +84,7 @@ public class StripeProducer extends DefaultProducer {
             return (Map<String, Object>) body;
         }
 
-        if (body instanceof String) {
-            String json = (String) body;
+        if (body instanceof String json) {
             if (json.trim().isEmpty()) {
                 return Collections.emptyMap();
             }


(camel) 10/22: (chores): modernize instanceof checks in camel-test-junit6

Posted by or...@apache.org.
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 041f89da9029a13c2d6a7a71a747d4bf455245d5
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 05:57:32 2026 +0000

    (chores): modernize instanceof checks in camel-test-junit6
---
 .../org/apache/camel/test/junit6/params/ParameterizedExtension.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/components/camel-test/camel-test-junit6/src/main/java/org/apache/camel/test/junit6/params/ParameterizedExtension.java b/components/camel-test/camel-test-junit6/src/main/java/org/apache/camel/test/junit6/params/ParameterizedExtension.java
index 6f6964ce3e87..881eaa8f9063 100644
--- a/components/camel-test/camel-test-junit6/src/main/java/org/apache/camel/test/junit6/params/ParameterizedExtension.java
+++ b/components/camel-test/camel-test-junit6/src/main/java/org/apache/camel/test/junit6/params/ParameterizedExtension.java
@@ -93,8 +93,8 @@ public class ParameterizedExtension implements TestTemplateInvocationContextProv
         }
         // Special treatment for one-dimensional reference arrays.
         // See https://github.com/junit-team/junit6/issues/1665
-        if (item instanceof Object[]) {
-            return arguments((Object[]) item);
+        if (item instanceof Object[] objects) {
+            return arguments(objects);
         }
         // Pass everything else "as is".
         return arguments(item);


(camel) 05/22: (chores): modernize instanceof checks in camel-docling

Posted by or...@apache.org.
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 23e19fbf2564a609b24418f6f60207cd4711cb86
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 05:54:18 2026 +0000

    (chores): modernize instanceof checks in camel-docling
---
 .../camel/component/docling/DoclingProducer.java   | 29 ++++++++++------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/components/camel-ai/camel-docling/src/main/java/org/apache/camel/component/docling/DoclingProducer.java b/components/camel-ai/camel-docling/src/main/java/org/apache/camel/component/docling/DoclingProducer.java
index 7963f368a339..d38842174a09 100644
--- a/components/camel-ai/camel-docling/src/main/java/org/apache/camel/component/docling/DoclingProducer.java
+++ b/components/camel-ai/camel-docling/src/main/java/org/apache/camel/component/docling/DoclingProducer.java
@@ -279,8 +279,8 @@ public class DoclingProducer extends DefaultProducer {
         String taskId = exchange.getIn().getHeader(DoclingHeaders.TASK_ID, String.class);
         if (taskId == null) {
             Object body = exchange.getIn().getBody();
-            if (body instanceof String) {
-                taskId = (String) body;
+            if (body instanceof String bodyString) {
+                taskId = bodyString;
             } else {
                 throw new IllegalArgumentException("Task ID must be provided in header CamelDoclingTaskId or in message body");
             }
@@ -764,14 +764,13 @@ public class DoclingProducer extends DefaultProducer {
         }
 
         // Handle Collection
-        if (body instanceof Collection) {
-            Collection<?> collection = (Collection<?>) body;
+        if (body instanceof Collection<?> collection) {
             return collection.stream()
                     .map(obj -> {
-                        if (obj instanceof String) {
-                            return (String) obj;
-                        } else if (obj instanceof File) {
-                            return ((File) obj).getAbsolutePath();
+                        if (obj instanceof String str) {
+                            return str;
+                        } else if (obj instanceof File file) {
+                            return file.getAbsolutePath();
                         } else {
                             return obj.toString();
                         }
@@ -780,13 +779,12 @@ public class DoclingProducer extends DefaultProducer {
         }
 
         // Handle String array
-        if (body instanceof String[]) {
-            return List.of((String[]) body);
+        if (body instanceof String[] strings) {
+            return List.of(strings);
         }
 
         // Handle File array
-        if (body instanceof File[]) {
-            File[] files = (File[]) body;
+        if (body instanceof File[] files) {
             List<String> paths = new ArrayList<>();
             for (File file : files) {
                 paths.add(file.getAbsolutePath());
@@ -795,8 +793,7 @@ public class DoclingProducer extends DefaultProducer {
         }
 
         // Handle single String (directory path to scan)
-        if (body instanceof String) {
-            String path = (String) body;
+        if (body instanceof String path) {
             File dir = new File(path);
             if (dir.isDirectory()) {
                 File[] files = dir.listFiles();
@@ -874,8 +871,8 @@ public class DoclingProducer extends DefaultProducer {
             throw new IOException("Async conversion was interrupted", e);
         } catch (ExecutionException e) {
             Throwable cause = e.getCause();
-            if (cause instanceof IOException) {
-                throw (IOException) cause;
+            if (cause instanceof IOException ioException) {
+                throw ioException;
             }
             throw new IOException("Async conversion failed: " + cause.getMessage(), cause);
         }


(camel) 01/22: (chores): modernize instanceof checks in camel-mock

Posted by or...@apache.org.
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 2c901e0af000f2c070213e29fb6ef9ce99ea02ad
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 04:58:48 2026 +0000

    (chores): modernize instanceof checks in camel-mock
---
 .../java/org/apache/camel/component/mock/MockValueBuilder.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/components/camel-mock/src/main/java/org/apache/camel/component/mock/MockValueBuilder.java b/components/camel-mock/src/main/java/org/apache/camel/component/mock/MockValueBuilder.java
index d33354721d96..4420a6180fb9 100644
--- a/components/camel-mock/src/main/java/org/apache/camel/component/mock/MockValueBuilder.java
+++ b/components/camel-mock/src/main/java/org/apache/camel/component/mock/MockValueBuilder.java
@@ -707,8 +707,8 @@ public class MockValueBuilder implements Expression, Predicate {
         }
 
         // JsonObject comparison
-        if (expected instanceof JsonObject jsonobject && actual instanceof JsonObject) {
-            return jsonObjectEquals(jsonobject, (JsonObject) actual, ignoreOrder);
+        if (expected instanceof JsonObject jsonobject && actual instanceof JsonObject actualJsonObject) {
+            return jsonObjectEquals(jsonobject, actualJsonObject, ignoreOrder);
         }
 
         // Map comparison (in case of deserialized maps)
@@ -717,8 +717,8 @@ public class MockValueBuilder implements Expression, Predicate {
         }
 
         // JsonArray comparison
-        if (expected instanceof JsonArray jsonarray && actual instanceof JsonArray) {
-            return jsonArrayEquals(jsonarray, (JsonArray) actual, ignoreOrder);
+        if (expected instanceof JsonArray jsonarray && actual instanceof JsonArray actualJsonArray) {
+            return jsonArrayEquals(jsonarray, actualJsonArray, ignoreOrder);
         }
 
         // List comparison (in case of deserialized lists)


(camel) 16/22: (chores): modernize instanceof checks in camel-aws-bedrock

Posted by or...@apache.org.
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 d58b64ab225284c09edbb4d615d81919a814144d
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 06:06:26 2026 +0000

    (chores): modernize instanceof checks in camel-aws-bedrock
---
 .../component/aws2/bedrock/runtime/BedrockProducer.java  | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockProducer.java b/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockProducer.java
index 72d6725707f5..aaeaf0503203 100644
--- a/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockProducer.java
+++ b/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockProducer.java
@@ -418,8 +418,8 @@ public class BedrockProducer extends DefaultProducer {
             throws InvalidPayloadException {
         if (getConfiguration().isPojoRequest()) {
             Object payload = exchange.getMessage().getMandatoryBody();
-            if (payload instanceof InvokeModelWithResponseStreamRequest) {
-                processStreamingRequest((InvokeModelWithResponseStreamRequest) payload, exchange);
+            if (payload instanceof InvokeModelWithResponseStreamRequest streamRequest) {
+                processStreamingRequest(streamRequest, exchange);
             }
         } else {
             InvokeModelWithResponseStreamRequest.Builder builder = InvokeModelWithResponseStreamRequest.builder();
@@ -527,8 +527,8 @@ public class BedrockProducer extends DefaultProducer {
 
         if (getConfiguration().isPojoRequest()) {
             Object payload = exchange.getMessage().getMandatoryBody();
-            if (payload instanceof ConverseRequest) {
-                request = (ConverseRequest) payload;
+            if (payload instanceof ConverseRequest converseRequest) {
+                request = converseRequest;
             } else {
                 throw new IllegalArgumentException(
                         "Converse operation requires ConverseRequest in POJO mode");
@@ -643,8 +643,8 @@ public class BedrockProducer extends DefaultProducer {
 
         if (getConfiguration().isPojoRequest()) {
             Object payload = exchange.getMessage().getMandatoryBody();
-            if (payload instanceof ConverseStreamRequest) {
-                request = (ConverseStreamRequest) payload;
+            if (payload instanceof ConverseStreamRequest streamRequest) {
+                request = streamRequest;
             } else {
                 throw new IllegalArgumentException(
                         "ConverseStream operation requires ConverseStreamRequest in POJO mode");
@@ -794,8 +794,8 @@ public class BedrockProducer extends DefaultProducer {
 
         if (getConfiguration().isPojoRequest()) {
             Object payload = exchange.getMessage().getMandatoryBody();
-            if (payload instanceof software.amazon.awssdk.services.bedrockruntime.model.ApplyGuardrailRequest) {
-                request = (software.amazon.awssdk.services.bedrockruntime.model.ApplyGuardrailRequest) payload;
+            if (payload instanceof software.amazon.awssdk.services.bedrockruntime.model.ApplyGuardrailRequest guardrailRequest) {
+                request = guardrailRequest;
             } else {
                 throw new IllegalArgumentException(
                         "ApplyGuardrail operation requires ApplyGuardrailRequest in POJO mode");


(camel) 06/22: (chores): modernize instanceof checks in camel-google-vertexai

Posted by or...@apache.org.
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 bbec894b9059f80616803a5bf43db9bd5cc4f1a3
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 05:55:57 2026 +0000

    (chores): modernize instanceof checks in camel-google-vertexai
---
 .../apache/camel/component/google/vertexai/GoogleVertexAIProducer.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/components/camel-google/camel-google-vertexai/src/main/java/org/apache/camel/component/google/vertexai/GoogleVertexAIProducer.java b/components/camel-google/camel-google-vertexai/src/main/java/org/apache/camel/component/google/vertexai/GoogleVertexAIProducer.java
index d5a2cb46b982..3bfb59ae94bc 100644
--- a/components/camel-google/camel-google-vertexai/src/main/java/org/apache/camel/component/google/vertexai/GoogleVertexAIProducer.java
+++ b/components/camel-google/camel-google-vertexai/src/main/java/org/apache/camel/component/google/vertexai/GoogleVertexAIProducer.java
@@ -235,8 +235,7 @@ public class GoogleVertexAIProducer extends DefaultProducer {
         String publisher = config.getPublisher();
 
         // If body is already a JSON string, use it as-is (but add anthropic_version if needed)
-        if (body instanceof String) {
-            String bodyStr = (String) body;
+        if (body instanceof String bodyStr) {
             if (bodyStr.trim().startsWith("{")) {
                 // It's JSON - add anthropic_version if Anthropic publisher and not already present
                 if ("anthropic".equals(publisher) && !bodyStr.contains("anthropic_version")) {


(camel) 19/22: (chores): modernize instanceof checks in camel-keycloak

Posted by or...@apache.org.
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 bdc927267b0e050f038302e948c6d72bce3436a1
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 06:06:48 2026 +0000

    (chores): modernize instanceof checks in camel-keycloak
---
 .../camel/component/keycloak/KeycloakProducer.java | 32 +++++++++++-----------
 .../security/KeycloakTokenIntrospector.java        | 14 +++++-----
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/components/camel-keycloak/src/main/java/org/apache/camel/component/keycloak/KeycloakProducer.java b/components/camel-keycloak/src/main/java/org/apache/camel/component/keycloak/KeycloakProducer.java
index ae5b2516c9cf..0e40dc1102a1 100644
--- a/components/camel-keycloak/src/main/java/org/apache/camel/component/keycloak/KeycloakProducer.java
+++ b/components/camel-keycloak/src/main/java/org/apache/camel/component/keycloak/KeycloakProducer.java
@@ -1307,9 +1307,9 @@ public class KeycloakProducer extends DefaultProducer {
 
         if (getConfiguration().isPojoRequest()) {
             Object payload = exchange.getIn().getMandatoryBody();
-            if (payload instanceof IdentityProviderRepresentation) {
+            if (payload instanceof IdentityProviderRepresentation idpRepresentation) {
                 Response response
-                        = keycloakClient.realm(realmName).identityProviders().create((IdentityProviderRepresentation) payload);
+                        = keycloakClient.realm(realmName).identityProviders().create(idpRepresentation);
                 Message message = getMessageForResponse(exchange);
                 message.setBody(response);
             }
@@ -1365,9 +1365,9 @@ public class KeycloakProducer extends DefaultProducer {
 
         if (getConfiguration().isPojoRequest()) {
             Object payload = exchange.getIn().getMandatoryBody();
-            if (payload instanceof IdentityProviderRepresentation) {
+            if (payload instanceof IdentityProviderRepresentation idpRepresentation) {
                 keycloakClient.realm(realmName).identityProviders().get(idpAlias)
-                        .update((IdentityProviderRepresentation) payload);
+                        .update(idpRepresentation);
                 Message message = getMessageForResponse(exchange);
                 message.setBody("Identity provider updated successfully");
             }
@@ -1402,9 +1402,9 @@ public class KeycloakProducer extends DefaultProducer {
 
         if (getConfiguration().isPojoRequest()) {
             Object payload = exchange.getIn().getMandatoryBody();
-            if (payload instanceof ResourceRepresentation) {
+            if (payload instanceof ResourceRepresentation resourceRepresentation) {
                 Response response = keycloakClient.realm(realmName).clients().get(clientUuid).authorization().resources()
-                        .create((ResourceRepresentation) payload);
+                        .create(resourceRepresentation);
                 Message message = getMessageForResponse(exchange);
                 message.setBody(response);
             }
@@ -1475,9 +1475,9 @@ public class KeycloakProducer extends DefaultProducer {
 
         if (getConfiguration().isPojoRequest()) {
             Object payload = exchange.getIn().getMandatoryBody();
-            if (payload instanceof ResourceRepresentation) {
+            if (payload instanceof ResourceRepresentation resourceRepresentation) {
                 keycloakClient.realm(realmName).clients().get(clientUuid).authorization().resources().resource(resourceId)
-                        .update((ResourceRepresentation) payload);
+                        .update(resourceRepresentation);
                 Message message = getMessageForResponse(exchange);
                 message.setBody("Resource updated successfully");
             }
@@ -1516,9 +1516,9 @@ public class KeycloakProducer extends DefaultProducer {
 
         if (getConfiguration().isPojoRequest()) {
             Object payload = exchange.getIn().getMandatoryBody();
-            if (payload instanceof PolicyRepresentation) {
+            if (payload instanceof PolicyRepresentation policyRepresentation) {
                 Response response = keycloakClient.realm(realmName).clients().get(clientUuid).authorization().policies()
-                        .create((PolicyRepresentation) payload);
+                        .create(policyRepresentation);
                 Message message = getMessageForResponse(exchange);
                 message.setBody(response);
             }
@@ -1589,9 +1589,9 @@ public class KeycloakProducer extends DefaultProducer {
 
         if (getConfiguration().isPojoRequest()) {
             Object payload = exchange.getIn().getMandatoryBody();
-            if (payload instanceof PolicyRepresentation) {
+            if (payload instanceof PolicyRepresentation policyRepresentation) {
                 keycloakClient.realm(realmName).clients().get(clientUuid).authorization().policies().policy(policyId)
-                        .update((PolicyRepresentation) payload);
+                        .update(policyRepresentation);
                 Message message = getMessageForResponse(exchange);
                 message.setBody("Policy updated successfully");
             }
@@ -1630,9 +1630,9 @@ public class KeycloakProducer extends DefaultProducer {
 
         if (getConfiguration().isPojoRequest()) {
             Object payload = exchange.getIn().getMandatoryBody();
-            if (payload instanceof ResourcePermissionRepresentation) {
+            if (payload instanceof ResourcePermissionRepresentation permissionRepresentation) {
                 Response response = keycloakClient.realm(realmName).clients().get(clientUuid).authorization().permissions()
-                        .resource().create((ResourcePermissionRepresentation) payload);
+                        .resource().create(permissionRepresentation);
                 Message message = getMessageForResponse(exchange);
                 message.setBody(response);
             }
@@ -1705,10 +1705,10 @@ public class KeycloakProducer extends DefaultProducer {
 
         if (getConfiguration().isPojoRequest()) {
             Object payload = exchange.getIn().getMandatoryBody();
-            if (payload instanceof PolicyRepresentation) {
+            if (payload instanceof PolicyRepresentation policyRepresentation) {
                 // Use policy endpoint for permissions
                 keycloakClient.realm(realmName).clients().get(clientUuid).authorization().policies().policy(permissionId)
-                        .update((PolicyRepresentation) payload);
+                        .update(policyRepresentation);
                 Message message = getMessageForResponse(exchange);
                 message.setBody("Permission updated successfully");
             }
diff --git a/components/camel-keycloak/src/main/java/org/apache/camel/component/keycloak/security/KeycloakTokenIntrospector.java b/components/camel-keycloak/src/main/java/org/apache/camel/component/keycloak/security/KeycloakTokenIntrospector.java
index 25f473c1fac2..61f6f1d62b4b 100644
--- a/components/camel-keycloak/src/main/java/org/apache/camel/component/keycloak/security/KeycloakTokenIntrospector.java
+++ b/components/camel-keycloak/src/main/java/org/apache/camel/component/keycloak/security/KeycloakTokenIntrospector.java
@@ -160,8 +160,8 @@ public class KeycloakTokenIntrospector {
 
             return result;
         } catch (Exception e) {
-            if (e instanceof IOException) {
-                throw (IOException) e;
+            if (e instanceof IOException ioException) {
+                throw ioException;
             }
             throw new IOException("Failed to introspect token", e);
         }
@@ -249,7 +249,7 @@ public class KeycloakTokenIntrospector {
          */
         public boolean isActive() {
             Object active = claims.get("active");
-            return active instanceof Boolean && (Boolean) active;
+            return active instanceof Boolean b && b;
         }
 
         /**
@@ -304,8 +304,8 @@ public class KeycloakTokenIntrospector {
          */
         public Long getExpiration() {
             Object exp = claims.get("exp");
-            if (exp instanceof Number) {
-                return ((Number) exp).longValue();
+            if (exp instanceof Number number) {
+                return number.longValue();
             }
             return null;
         }
@@ -317,8 +317,8 @@ public class KeycloakTokenIntrospector {
          */
         public Long getIssuedAt() {
             Object iat = claims.get("iat");
-            if (iat instanceof Number) {
-                return ((Number) iat).longValue();
+            if (iat instanceof Number number) {
+                return number.longValue();
             }
             return null;
         }


(camel) 07/22: (chores): modernize instanceof checks in camel-langchain4j-agent-api

Posted by or...@apache.org.
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 0f1586b646601968a3191007b2d6572364aacdef
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 05:56:00 2026 +0000

    (chores): modernize instanceof checks in camel-langchain4j-agent-api
---
 .../java/org/apache/camel/component/langchain4j/agent/api/Agent.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/components/camel-ai/camel-langchain4j-agent-api/src/main/java/org/apache/camel/component/langchain4j/agent/api/Agent.java b/components/camel-ai/camel-langchain4j-agent-api/src/main/java/org/apache/camel/component/langchain4j/agent/api/Agent.java
index d8be18186470..532f73cd59f0 100644
--- a/components/camel-ai/camel-langchain4j-agent-api/src/main/java/org/apache/camel/component/langchain4j/agent/api/Agent.java
+++ b/components/camel-ai/camel-langchain4j-agent-api/src/main/java/org/apache/camel/component/langchain4j/agent/api/Agent.java
@@ -96,10 +96,10 @@ public interface Agent {
             return payload;
         }
 
-        if (messagePayload instanceof String) {
+        if (messagePayload instanceof String stringPayload) {
             String systemMessage = exchange.getIn().getHeader(SYSTEM_MESSAGE, String.class);
             Object memoryId = exchange.getIn().getHeader(MEMORY_ID);
-            return new AiAgentBody<>((String) messagePayload, systemMessage, memoryId);
+            return new AiAgentBody<>(stringPayload, systemMessage, memoryId);
         }
 
         // Try to convert using TypeConverter (supports WrappedFile, byte[], InputStream, etc.)


(camel) 17/22: (chores): modernize instanceof checks in camel-hashicorp-vault

Posted by or...@apache.org.
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 0b3b7665751753894d5e672a47754d293f2b339e
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 06:06:34 2026 +0000

    (chores): modernize instanceof checks in camel-hashicorp-vault
---
 .../hashicorp/vault/vault/HashicorpVaultReloadTriggerTask.java        | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/vault/HashicorpVaultReloadTriggerTask.java b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/vault/HashicorpVaultReloadTriggerTask.java
index bdf634f61980..da4be636d73c 100644
--- a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/vault/HashicorpVaultReloadTriggerTask.java
+++ b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/vault/HashicorpVaultReloadTriggerTask.java
@@ -121,8 +121,8 @@ public class HashicorpVaultReloadTriggerTask extends ServiceSupport implements C
         // auto-detect secrets in-use
         PropertiesComponent pc = camelContext.getPropertiesComponent();
         PropertiesFunction pf = pc.getPropertiesFunction("hashicorp");
-        if (pf instanceof HashicorpVaultPropertiesFunction) {
-            propertiesFunction = (HashicorpVaultPropertiesFunction) pf;
+        if (pf instanceof HashicorpVaultPropertiesFunction vaultPropertiesFunction) {
+            propertiesFunction = vaultPropertiesFunction;
             LOG.debug("Auto-detecting secrets from properties-function: {}", pf.getName());
         }
         // specific secrets


(camel) 18/22: (chores): modernize instanceof checks in camel-as2-api

Posted by or...@apache.org.
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 fea56e87e351e262fabb71e0724180f62a0f6c8a
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 06:06:41 2026 +0000

    (chores): modernize instanceof checks in camel-as2-api
---
 .../java/org/apache/camel/component/as2/api/AS2ServerConnection.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ServerConnection.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ServerConnection.java
index 5af6b02fa636..a27c86f6778f 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ServerConnection.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ServerConnection.java
@@ -264,9 +264,9 @@ public class AS2ServerConnection {
         @Override
         public void process(HttpRequest request, EntityDetails entityDetails, HttpContext context)
                 throws HttpException, IOException {
-            if (request instanceof ClassicHttpRequest) {
+            if (request instanceof ClassicHttpRequest classicHttpRequest) {
                 // Now safely calling the method on the outer class instance (AS2ServerConnection.this)
-                AS2ServerConnection.this.setupConfigurationForRequest((ClassicHttpRequest) request, context);
+                AS2ServerConnection.this.setupConfigurationForRequest(classicHttpRequest, context);
             }
         }
     }


(camel) 15/22: (chores): modernize instanceof checks in camel-spring-ai-vector-store

Posted by or...@apache.org.
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 8ae89f39d5ac4a78925e53db91b1fb536822d607
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 05:59:57 2026 +0000

    (chores): modernize instanceof checks in camel-spring-ai-vector-store
---
 .../vectorstore/SpringAiVectorStoreProducer.java   | 30 ++++++++++------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-vector-store/src/main/java/org/apache/camel/component/springai/vectorstore/SpringAiVectorStoreProducer.java b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-vector-store/src/main/java/org/apache/camel/component/springai/vectorstore/SpringAiVectorStoreProducer.java
index 171baa2878d0..e8b777ada8e7 100644
--- a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-vector-store/src/main/java/org/apache/camel/component/springai/vectorstore/SpringAiVectorStoreProducer.java
+++ b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-vector-store/src/main/java/org/apache/camel/component/springai/vectorstore/SpringAiVectorStoreProducer.java
@@ -70,9 +70,9 @@ public class SpringAiVectorStoreProducer extends DefaultProducer {
         String inputText = message.getHeader("CamelSpringAiEmbeddingInputText", String.class);
         Object body = message.getBody();
 
-        if (inputText != null && body instanceof float[]) {
+        if (inputText != null && body instanceof float[] floats) {
             // Create document from embedding component output with pre-computed embedding
-            Document doc = createDocumentWithEmbedding(inputText, (float[]) body);
+            Document doc = createDocumentWithEmbedding(inputText, floats);
             documents.add(doc);
         } else if (inputText != null) {
             // Create document from embedding component output (text only, vector store will embed)
@@ -82,8 +82,7 @@ public class SpringAiVectorStoreProducer extends DefaultProducer {
             // Check for batch texts and embeddings
             List<String> inputTexts = message.getHeader("CamelSpringAiEmbeddingInputTexts", List.class);
 
-            if (inputTexts != null && !inputTexts.isEmpty() && body instanceof List) {
-                List<?> bodyList = (List<?>) body;
+            if (inputTexts != null && !inputTexts.isEmpty() && body instanceof List<?> bodyList) {
                 // Check if body contains float arrays (pre-computed embeddings)
                 if (!bodyList.isEmpty() && bodyList.get(0) instanceof float[]) {
                     // Create documents with pre-computed embeddings
@@ -107,21 +106,20 @@ public class SpringAiVectorStoreProducer extends DefaultProducer {
                 }
             } else {
                 // Try to get documents directly from body
-                if (body instanceof Document) {
-                    documents.add((Document) body);
-                } else if (body instanceof List) {
-                    List<?> list = (List<?>) body;
+                if (body instanceof Document doc) {
+                    documents.add(doc);
+                } else if (body instanceof List<?> list) {
                     for (Object item : list) {
-                        if (item instanceof Document) {
-                            documents.add((Document) item);
-                        } else if (item instanceof String) {
+                        if (item instanceof Document doc) {
+                            documents.add(doc);
+                        } else if (item instanceof String str) {
                             // Create document from text (vector store will generate embeddings)
-                            documents.add(new Document((String) item));
+                            documents.add(new Document(str));
                         }
                     }
-                } else if (body instanceof String) {
+                } else if (body instanceof String str) {
                     // Create document from text
-                    documents.add(new Document((String) body));
+                    documents.add(new Document(str));
                 } else {
                     throw new IllegalArgumentException(
                             "Message body must be a Document, List<Document>, String, List<String>, " +
@@ -165,8 +163,8 @@ public class SpringAiVectorStoreProducer extends DefaultProducer {
             Object body = message.getBody();
             if (body instanceof List) {
                 documentIds = (List<String>) body;
-            } else if (body instanceof String) {
-                documentIds = List.of((String) body);
+            } else if (body instanceof String str) {
+                documentIds = List.of(str);
             }
         }
 


(camel) 20/22: (chores): modernize instanceof checks in camel-pqc

Posted by or...@apache.org.
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 8924189aaf3886168c967d8330b9cf548411b5ff
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 06:06:54 2026 +0000

    (chores): modernize instanceof checks in camel-pqc
---
 .../pqc/lifecycle/AwsSecretsManagerKeyLifecycleManager.java       | 8 ++++----
 .../component/pqc/lifecycle/FileBasedKeyLifecycleManager.java     | 8 ++++----
 .../pqc/lifecycle/HashicorpVaultKeyLifecycleManager.java          | 8 ++++----
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/AwsSecretsManagerKeyLifecycleManager.java b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/AwsSecretsManagerKeyLifecycleManager.java
index 46a37c426630..36da6ffd19f4 100644
--- a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/AwsSecretsManagerKeyLifecycleManager.java
+++ b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/AwsSecretsManagerKeyLifecycleManager.java
@@ -181,10 +181,10 @@ public class AwsSecretsManagerKeyLifecycleManager implements KeyLifecycleManager
 
         // Initialize with parameter spec if provided
         if (parameterSpec != null) {
-            if (parameterSpec instanceof AlgorithmParameterSpec) {
-                generator.initialize((AlgorithmParameterSpec) parameterSpec, new SecureRandom());
-            } else if (parameterSpec instanceof Integer) {
-                generator.initialize((Integer) parameterSpec, new SecureRandom());
+            if (parameterSpec instanceof AlgorithmParameterSpec algorithmParamSpec) {
+                generator.initialize(algorithmParamSpec, new SecureRandom());
+            } else if (parameterSpec instanceof Integer keySize) {
+                generator.initialize(keySize, new SecureRandom());
             }
         } else {
             // Use default parameter spec for the algorithm
diff --git a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/FileBasedKeyLifecycleManager.java b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/FileBasedKeyLifecycleManager.java
index 7e5df8c45b70..6931ab483e51 100644
--- a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/FileBasedKeyLifecycleManager.java
+++ b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/FileBasedKeyLifecycleManager.java
@@ -82,10 +82,10 @@ public class FileBasedKeyLifecycleManager implements KeyLifecycleManager {
 
         // Initialize with parameter spec if provided
         if (parameterSpec != null) {
-            if (parameterSpec instanceof AlgorithmParameterSpec) {
-                generator.initialize((AlgorithmParameterSpec) parameterSpec, new SecureRandom());
-            } else if (parameterSpec instanceof Integer) {
-                generator.initialize((Integer) parameterSpec, new SecureRandom());
+            if (parameterSpec instanceof AlgorithmParameterSpec algorithmParamSpec) {
+                generator.initialize(algorithmParamSpec, new SecureRandom());
+            } else if (parameterSpec instanceof Integer keySize) {
+                generator.initialize(keySize, new SecureRandom());
             }
         } else {
             // Use default parameter spec for the algorithm
diff --git a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/HashicorpVaultKeyLifecycleManager.java b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/HashicorpVaultKeyLifecycleManager.java
index e12fa218134d..aef3741f11ac 100644
--- a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/HashicorpVaultKeyLifecycleManager.java
+++ b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/HashicorpVaultKeyLifecycleManager.java
@@ -196,10 +196,10 @@ public class HashicorpVaultKeyLifecycleManager implements KeyLifecycleManager {
 
         // Initialize with parameter spec if provided
         if (parameterSpec != null) {
-            if (parameterSpec instanceof AlgorithmParameterSpec) {
-                generator.initialize((AlgorithmParameterSpec) parameterSpec, new SecureRandom());
-            } else if (parameterSpec instanceof Integer) {
-                generator.initialize((Integer) parameterSpec, new SecureRandom());
+            if (parameterSpec instanceof AlgorithmParameterSpec algorithmParamSpec) {
+                generator.initialize(algorithmParamSpec, new SecureRandom());
+            } else if (parameterSpec instanceof Integer keySize) {
+                generator.initialize(keySize, new SecureRandom());
             }
         } else {
             // Use default parameter spec for the algorithm


(camel) 08/22: (chores): modernize instanceof checks in camel-aws2-s3-vectors

Posted by or...@apache.org.
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 a5cc193ed22905ba0fe6d3e3cec96f08261b171c
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 05:56:03 2026 +0000

    (chores): modernize instanceof checks in camel-aws2-s3-vectors
---
 .../aws2/s3vectors/AWS2S3VectorsProducer.java      | 24 +++++++++-------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/components/camel-aws/camel-aws2-s3-vectors/src/main/java/org/apache/camel/component/aws2/s3vectors/AWS2S3VectorsProducer.java b/components/camel-aws/camel-aws2-s3-vectors/src/main/java/org/apache/camel/component/aws2/s3vectors/AWS2S3VectorsProducer.java
index 6ac1e5344bb1..b6d6df3fd982 100644
--- a/components/camel-aws/camel-aws2-s3-vectors/src/main/java/org/apache/camel/component/aws2/s3vectors/AWS2S3VectorsProducer.java
+++ b/components/camel-aws/camel-aws2-s3-vectors/src/main/java/org/apache/camel/component/aws2/s3vectors/AWS2S3VectorsProducer.java
@@ -443,28 +443,25 @@ public class AWS2S3VectorsProducer extends DefaultProducer {
             throw new IllegalArgumentException("Vector data cannot be null");
         }
 
-        if (obj instanceof List) {
-            List<?> list = (List<?>) obj;
+        if (obj instanceof List<?> list) {
             List<Float> result = new ArrayList<>(list.size());
             for (Object item : list) {
-                if (item instanceof Float) {
-                    result.add((Float) item);
-                } else if (item instanceof Number) {
-                    result.add(((Number) item).floatValue());
+                if (item instanceof Float floatItem) {
+                    result.add(floatItem);
+                } else if (item instanceof Number number) {
+                    result.add(number.floatValue());
                 } else {
                     throw new IllegalArgumentException("Invalid vector data type: " + item.getClass());
                 }
             }
             return result;
-        } else if (obj instanceof float[]) {
-            float[] array = (float[]) obj;
+        } else if (obj instanceof float[] array) {
             List<Float> result = new ArrayList<>(array.length);
             for (float f : array) {
                 result.add(f);
             }
             return result;
-        } else if (obj instanceof double[]) {
-            double[] array = (double[]) obj;
+        } else if (obj instanceof double[] array) {
             List<Float> result = new ArrayList<>(array.length);
             for (double d : array) {
                 result.add((float) d);
@@ -483,12 +480,11 @@ public class AWS2S3VectorsProducer extends DefaultProducer {
 
         if (obj instanceof List) {
             return (List<String>) obj;
-        } else if (obj instanceof String) {
+        } else if (obj instanceof String str) {
             List<String> result = new ArrayList<>();
-            result.add((String) obj);
+            result.add(str);
             return result;
-        } else if (obj instanceof String[]) {
-            String[] array = (String[]) obj;
+        } else if (obj instanceof String[] array) {
             List<String> result = new ArrayList<>(array.length);
             for (String s : array) {
                 result.add(s);


(camel) 11/22: (chores): modernize instanceof checks in camel-package-maven-plugin

Posted by or...@apache.org.
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 60477adf5baf1f0af0c923f699aa31e712ba90f8
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 05:57:35 2026 +0000

    (chores): modernize instanceof checks in camel-package-maven-plugin
---
 .../org/apache/camel/maven/packaging/UpdateHeaderImportantHelper.java | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateHeaderImportantHelper.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateHeaderImportantHelper.java
index 7cbd21e70725..b718654cc15d 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateHeaderImportantHelper.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateHeaderImportantHelper.java
@@ -86,9 +86,7 @@ public class UpdateHeaderImportantHelper extends AbstractGeneratorMojo {
             try {
                 String json = PackageHelper.loadText(file.toFile());
                 Object jo = Jsoner.deserialize(json);
-                JsonObject obj;
-                if (jo instanceof JsonObject) {
-                    obj = (JsonObject) jo;
+                if (jo instanceof JsonObject obj) {
                 } else {
                     continue;
                 }


(camel) 13/22: (chores): modernize instanceof checks in camel-spring-ai-chat

Posted by or...@apache.org.
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 6424bfbacaf9b7a8a2156ab9d3a2f5d04821f3ee
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 05:59:51 2026 +0000

    (chores): modernize instanceof checks in camel-spring-ai-chat
---
 .../component/springai/chat/SpringAiChatProducer.java     | 15 +++++++--------
 .../springai/chat/rag/SpringAiRagAggregatorStrategy.java  |  8 ++++----
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/java/org/apache/camel/component/springai/chat/SpringAiChatProducer.java b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/java/org/apache/camel/component/springai/chat/SpringAiChatProducer.java
index 3ff76ccef2fa..e39a23392827 100644
--- a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/java/org/apache/camel/component/springai/chat/SpringAiChatProducer.java
+++ b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/java/org/apache/camel/component/springai/chat/SpringAiChatProducer.java
@@ -154,21 +154,20 @@ public class SpringAiChatProducer extends DefaultProducer {
         }
 
         // Handle different body types
-        if (messageBody instanceof String) {
-            userMessageText = (String) messageBody;
-        } else if (messageBody instanceof UserMessage) {
-            UserMessage userMsg = (UserMessage) messageBody;
+        if (messageBody instanceof String stringBody) {
+            userMessageText = stringBody;
+        } else if (messageBody instanceof UserMessage userMsg) {
             userMessageText = userMsg.getText();
             // If there's media, we need to handle it differently using additive builder
             if (!userMsg.getMedia().isEmpty()) {
                 applyUserMessageWithMedia(request, exchange, userMsg.getText(), userMsg.getMedia());
                 userMessageText = null; // Already handled
             }
-        } else if (messageBody instanceof Message) {
+        } else if (messageBody instanceof Message message) {
             // Note: Using request.messages() here replaces the entire message list,
             // which will ignore any default system message configured in doStart() or via headers.
             // This is intentional for the CHAT_SINGLE_MESSAGE operation when a complete Message is provided.
-            request.messages((Message) messageBody);
+            request.messages(message);
         } else if (messageBody instanceof WrappedFile) {
             // Handle single WrappedFile for multimodal content
             WrappedFile<?> wrappedFile = (WrappedFile<?>) messageBody;
@@ -189,9 +188,9 @@ public class SpringAiChatProducer extends DefaultProducer {
                         "List body must contain WrappedFile objects. Got: "
                                                    + (list.isEmpty() ? "empty list" : list.get(0).getClass().getName()));
             }
-        } else if (messageBody instanceof byte[]) {
+        } else if (messageBody instanceof byte[] bytes) {
             // Handle multimodal content (image or audio)
-            UserMessage multimodalMessage = createMultimodalMessage(exchange, (byte[]) messageBody);
+            UserMessage multimodalMessage = createMultimodalMessage(exchange, bytes);
             applyUserMessageWithMedia(request, exchange, multimodalMessage.getText(), multimodalMessage.getMedia());
         } else {
             throw new IllegalArgumentException(
diff --git a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/java/org/apache/camel/component/springai/chat/rag/SpringAiRagAggregatorStrategy.java b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/java/org/apache/camel/component/springai/chat/rag/SpringAiRagAggregatorStrategy.java
index 0f6f05027841..eafd6b6044b2 100644
--- a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/java/org/apache/camel/component/springai/chat/rag/SpringAiRagAggregatorStrategy.java
+++ b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/java/org/apache/camel/component/springai/chat/rag/SpringAiRagAggregatorStrategy.java
@@ -68,10 +68,10 @@ public class SpringAiRagAggregatorStrategy implements AggregationStrategy {
         // Convert to Spring AI Documents
         List<Document> newDocuments = new ArrayList<>();
         for (Object item : newAugmentedData.get()) {
-            if (item instanceof String) {
-                newDocuments.add(new Document((String) item));
-            } else if (item instanceof Document) {
-                newDocuments.add((Document) item);
+            if (item instanceof String str) {
+                newDocuments.add(new Document(str));
+            } else if (item instanceof Document document) {
+                newDocuments.add(document);
             } else {
                 // Try to convert to string
                 newDocuments.add(new Document(item.toString()));


(camel) 14/22: (chores): modernize instanceof checks in camel-spring-ai-embeddings

Posted by or...@apache.org.
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 4eb82762c629f79af3014b5bdc823878146b6d3a
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 05:59:55 2026 +0000

    (chores): modernize instanceof checks in camel-spring-ai-embeddings
---
 .../component/springai/embeddings/SpringAiEmbeddingsProducer.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-embeddings/src/main/java/org/apache/camel/component/springai/embeddings/SpringAiEmbeddingsProducer.java b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-embeddings/src/main/java/org/apache/camel/component/springai/embeddings/SpringAiEmbeddingsProducer.java
index ef401fa5a019..c34730611a5c 100644
--- a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-embeddings/src/main/java/org/apache/camel/component/springai/embeddings/SpringAiEmbeddingsProducer.java
+++ b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-embeddings/src/main/java/org/apache/camel/component/springai/embeddings/SpringAiEmbeddingsProducer.java
@@ -47,8 +47,8 @@ public class SpringAiEmbeddingsProducer extends DefaultProducer {
         List<String> inputTexts;
         Object body = message.getBody();
 
-        if (body instanceof String) {
-            inputTexts = List.of((String) body);
+        if (body instanceof String str) {
+            inputTexts = List.of(str);
         } else if (body instanceof List) {
             inputTexts = (List<String>) body;
         } else {


(camel) 02/22: (chores): modernize instanceof checks in camel-jbang-core

Posted by or...@apache.org.
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 a97bcab119c3e8340409a77c4171f4973414ac79
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 05:49:44 2026 +0000

    (chores): modernize instanceof checks in camel-jbang-core
---
 .../java/org/apache/camel/dsl/jbang/core/commands/Explain.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Explain.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Explain.java
index f94cad65cb0c..15f6c70458c9 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Explain.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Explain.java
@@ -458,11 +458,11 @@ public class Explain extends CamelCommand {
     }
 
     private String getModelDescription(Object model) {
-        if (model instanceof ComponentModel) {
-            return ((ComponentModel) model).getDescription();
+        if (model instanceof ComponentModel componentModel) {
+            return componentModel.getDescription();
         }
-        if (model instanceof EipModel) {
-            return ((EipModel) model).getDescription();
+        if (model instanceof EipModel eipModel) {
+            return eipModel.getDescription();
         }
         return null;
     }


(camel) 21/22: (chores): modernize instanceof checks in camel-milo

Posted by or...@apache.org.
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 28dc623f6cd9c4b02d30906f848e9bf99549069d
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 06:06:59 2026 +0000

    (chores): modernize instanceof checks in camel-milo
---
 .../org/apache/camel/component/milo/KeyStoreLoader.java  |  4 ++--
 .../java/org/apache/camel/component/milo/NodeIds.java    | 16 ++++++++--------
 .../component/milo/client/MiloClientConnection.java      | 16 ++++++++--------
 .../milo/client/internal/SubscriptionManager.java        |  3 +--
 .../camel/component/milo/server/MiloServerComponent.java |  4 ++--
 .../component/milo/server/internal/CamelServerItem.java  |  8 ++++----
 6 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/components/camel-milo/src/main/java/org/apache/camel/component/milo/KeyStoreLoader.java b/components/camel-milo/src/main/java/org/apache/camel/component/milo/KeyStoreLoader.java
index e91947ae254c..61ddf47e9577 100644
--- a/components/camel-milo/src/main/java/org/apache/camel/component/milo/KeyStoreLoader.java
+++ b/components/camel-milo/src/main/java/org/apache/camel/component/milo/KeyStoreLoader.java
@@ -131,14 +131,14 @@ public class KeyStoreLoader {
         final Key privateKey
                 = keyStore.getKey(effectiveKeyAlias, this.keyPassword != null ? this.keyPassword.toCharArray() : null);
 
-        if (privateKey instanceof PrivateKey) {
+        if (privateKey instanceof PrivateKey pk) {
             final X509Certificate certificate = (X509Certificate) keyStore.getCertificate(effectiveKeyAlias);
             if (certificate == null) {
                 return null;
             }
 
             final PublicKey publicKey = certificate.getPublicKey();
-            final KeyPair keyPair = new KeyPair(publicKey, (PrivateKey) privateKey);
+            final KeyPair keyPair = new KeyPair(publicKey, pk);
             return new Result(certificate, keyPair);
         }
 
diff --git a/components/camel-milo/src/main/java/org/apache/camel/component/milo/NodeIds.java b/components/camel-milo/src/main/java/org/apache/camel/component/milo/NodeIds.java
index 845507a08371..5307e8289128 100644
--- a/components/camel-milo/src/main/java/org/apache/camel/component/milo/NodeIds.java
+++ b/components/camel-milo/src/main/java/org/apache/camel/component/milo/NodeIds.java
@@ -42,14 +42,14 @@ public final class NodeIds {
 
         final Object id = nodeId.getIdentifier();
 
-        if (id instanceof String) {
-            return new NodeId(namespaceIndex, (String) id);
-        } else if (id instanceof UInteger) {
-            return new NodeId(namespaceIndex, (UInteger) id);
-        } else if (id instanceof ByteString) {
-            return new NodeId(namespaceIndex, (ByteString) id);
-        } else if (id instanceof UUID) {
-            return new NodeId(namespaceIndex, (UUID) id);
+        if (id instanceof String str) {
+            return new NodeId(namespaceIndex, str);
+        } else if (id instanceof UInteger uInteger) {
+            return new NodeId(namespaceIndex, uInteger);
+        } else if (id instanceof ByteString byteString) {
+            return new NodeId(namespaceIndex, byteString);
+        } else if (id instanceof UUID uuid) {
+            return new NodeId(namespaceIndex, uuid);
         }
 
         throw new IllegalStateException("Invalid id type: " + id);
diff --git a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConnection.java b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConnection.java
index 9bd1b9342704..bf21bace3584 100644
--- a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConnection.java
+++ b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConnection.java
@@ -133,11 +133,11 @@ public class MiloClientConnection implements AutoCloseable {
             return new Variant[0];
         }
 
-        if (value instanceof Variant[]) {
-            return (Variant[]) value;
+        if (value instanceof Variant[] variants) {
+            return variants;
         }
-        if (value instanceof Variant) {
-            return new Variant[] { (Variant) value };
+        if (value instanceof Variant variant) {
+            return new Variant[] { variant };
         }
 
         return new Variant[] { new Variant(value) };
@@ -150,11 +150,11 @@ public class MiloClientConnection implements AutoCloseable {
      * @return       the outgoing value
      */
     private DataValue mapWriteValue(final Object value) {
-        if (value instanceof DataValue) {
-            return (DataValue) value;
+        if (value instanceof DataValue dataValue) {
+            return dataValue;
         }
-        if (value instanceof Variant) {
-            return new DataValue((Variant) value, StatusCode.GOOD, null, null);
+        if (value instanceof Variant variant) {
+            return new DataValue(variant, StatusCode.GOOD, null, null);
         }
         return new DataValue(new Variant(value), StatusCode.GOOD, null, null);
     }
diff --git a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/internal/SubscriptionManager.java b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/internal/SubscriptionManager.java
index 07656e4e88af..ad2b2cd9b06a 100644
--- a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/internal/SubscriptionManager.java
+++ b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/internal/SubscriptionManager.java
@@ -283,8 +283,7 @@ public class SubscriptionManager {
             return future.thenApply(value -> {
                 final Object rawValue = value.getValue().getValue();
 
-                if (rawValue instanceof String[]) {
-                    final String[] namespaces = (String[]) rawValue;
+                if (rawValue instanceof String[] namespaces) {
                     for (int i = 0; i < namespaces.length; i++) {
                         if (namespaces[i].equals(namespaceUri)) {
                             final UShort result = Unsigned.ushort(i);
diff --git a/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerComponent.java b/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerComponent.java
index 489535f33b85..f3fad98863a9 100644
--- a/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerComponent.java
+++ b/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerComponent.java
@@ -203,11 +203,11 @@ public class MiloServerComponent extends DefaultComponent {
 
         if (certificateValidator != null) {
             LOG.debug("Using validator: {}", certificateValidator);
-            if (certificateValidator instanceof Closeable) {
+            if (certificateValidator instanceof Closeable closeable) {
                 runOnStop(() -> {
                     try {
                         LOG.debug("Closing: {}", certificateValidator);
-                        ((Closeable) certificateValidator).close();
+                        closeable.close();
                     } catch (IOException e) {
                         LOG.debug("Failed to close. This exception is ignored.", e);
                     }
diff --git a/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/internal/CamelServerItem.java b/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/internal/CamelServerItem.java
index 61375e32ef96..cc8d1d742bf6 100644
--- a/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/internal/CamelServerItem.java
+++ b/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/internal/CamelServerItem.java
@@ -152,10 +152,10 @@ public class CamelServerItem {
     }
 
     public void update(final Object value) {
-        if (value instanceof DataValue) {
-            this.value = (DataValue) value;
-        } else if (value instanceof Variant) {
-            this.value = new DataValue((Variant) value, StatusCode.GOOD, DateTime.now());
+        if (value instanceof DataValue dataValue) {
+            this.value = dataValue;
+        } else if (value instanceof Variant variant) {
+            this.value = new DataValue(variant, StatusCode.GOOD, DateTime.now());
         } else {
             this.value = new DataValue(new Variant(value), StatusCode.GOOD, DateTime.now());
         }


(camel) 03/22: (chores): modernize instanceof checks in camel-ibm-watsonx-ai

Posted by or...@apache.org.
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 e4336ed75f355ff226cbee94bc737a35b1db743d
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 05:51:14 2026 +0000

    (chores): modernize instanceof checks in camel-ibm-watsonx-ai
---
 .../ibm/watsonx/ai/handler/AbstractWatsonxAiHandler.java | 16 ++++++++--------
 .../ibm/watsonx/ai/handler/DeploymentHandler.java        |  3 +--
 .../ibm/watsonx/ai/handler/ForecastHandler.java          |  3 +--
 .../component/ibm/watsonx/ai/handler/ToolHandler.java    |  4 ++--
 4 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/AbstractWatsonxAiHandler.java b/components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/AbstractWatsonxAiHandler.java
index 2fbf51f97abb..6f80e54cb435 100644
--- a/components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/AbstractWatsonxAiHandler.java
+++ b/components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/AbstractWatsonxAiHandler.java
@@ -86,9 +86,9 @@ public abstract class AbstractWatsonxAiHandler implements WatsonxAiOperationHand
             Object body = in.getBody();
             if (body instanceof List) {
                 inputs = (List<String>) body;
-            } else if (body instanceof String) {
+            } else if (body instanceof String bodyString) {
                 // Single string input
-                inputs = List.of((String) body);
+                inputs = List.of(bodyString);
             }
         }
 
@@ -118,8 +118,8 @@ public abstract class AbstractWatsonxAiHandler implements WatsonxAiOperationHand
             // If no USER_MESSAGE header, try body
             if (userMessage == null) {
                 Object body = in.getBody();
-                if (body instanceof String) {
-                    userMessage = (String) body;
+                if (body instanceof String bodyString) {
+                    userMessage = bodyString;
                 } else if (body instanceof List) {
                     // Body is a list of messages
                     return (List<ChatMessage>) body;
@@ -160,9 +160,9 @@ public abstract class AbstractWatsonxAiHandler implements WatsonxAiOperationHand
             WrappedFile<?> wrappedFile = (WrappedFile<?>) body;
             Object fileObject = wrappedFile.getFile();
 
-            if (fileObject instanceof File) {
+            if (fileObject instanceof File file) {
                 // Local file (file:// component)
-                return FileInput.of((File) fileObject);
+                return FileInput.of(file);
             } else {
                 // Remote file (ftp://, sftp://) - use type converter to get InputStream
                 String fileName = resolveFileName(in);
@@ -172,8 +172,8 @@ public abstract class AbstractWatsonxAiHandler implements WatsonxAiOperationHand
         }
 
         // 2. Check for direct File
-        if (body instanceof File) {
-            return FileInput.of((File) body);
+        if (body instanceof File file) {
+            return FileInput.of(file);
         }
 
         // 3. Check FILE header
diff --git a/components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/DeploymentHandler.java b/components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/DeploymentHandler.java
index e10502bb4b6f..6a7501e6bd4a 100644
--- a/components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/DeploymentHandler.java
+++ b/components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/DeploymentHandler.java
@@ -239,8 +239,7 @@ public class DeploymentHandler extends AbstractWatsonxAiHandler {
         // If not in headers, try to get from body as TimeSeriesRequest
         if (inputSchema == null || forecastData == null) {
             Object body = in.getBody();
-            if (body instanceof TimeSeriesRequest) {
-                TimeSeriesRequest request = (TimeSeriesRequest) body;
+            if (body instanceof TimeSeriesRequest request) {
                 inputSchema = request.inputSchema();
                 forecastData = request.data();
             }
diff --git a/components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/ForecastHandler.java b/components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/ForecastHandler.java
index 6e94ce717844..a2f03e94353b 100644
--- a/components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/ForecastHandler.java
+++ b/components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/ForecastHandler.java
@@ -62,8 +62,7 @@ public class ForecastHandler extends AbstractWatsonxAiHandler {
         // If not in headers, try to get from body as TimeSeriesRequest
         if (inputSchema == null || forecastData == null) {
             Object body = in.getBody();
-            if (body instanceof TimeSeriesRequest) {
-                TimeSeriesRequest request = (TimeSeriesRequest) body;
+            if (body instanceof TimeSeriesRequest request) {
                 inputSchema = request.inputSchema();
                 forecastData = request.data();
             }
diff --git a/components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/ToolHandler.java b/components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/ToolHandler.java
index 56a8faee639a..4b834153b7d2 100644
--- a/components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/ToolHandler.java
+++ b/components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/ToolHandler.java
@@ -88,9 +88,9 @@ public class ToolHandler extends AbstractWatsonxAiHandler {
             if (body instanceof Map) {
                 // Structured input
                 toolRequest = ToolRequest.structuredInput(toolName, (Map<String, Object>) body, config);
-            } else if (body instanceof String) {
+            } else if (body instanceof String bodyString) {
                 // Unstructured input
-                toolRequest = ToolRequest.unstructuredInput(toolName, (String) body, config);
+                toolRequest = ToolRequest.unstructuredInput(toolName, bodyString, config);
             } else {
                 throw new IllegalArgumentException(
                         "Tool input must be provided as Map (structured) or String (unstructured) in message body");


(camel) 04/22: (chores): modernize instanceof checks in camel-telegram

Posted by or...@apache.org.
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 68105d9bcc59721445d9a0243132700fd59e60d9
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 05:52:59 2026 +0000

    (chores): modernize instanceof checks in camel-telegram
---
 .../apache/camel/component/telegram/model/PaidMedia.java   |  6 +++---
 .../telegram/model/payments/RevenueWithdrawalState.java    |  6 +++---
 .../telegram/model/payments/TransactionPartner.java        | 14 +++++++-------
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/PaidMedia.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/PaidMedia.java
index 015cdcc6512d..a9208394642a 100644
--- a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/PaidMedia.java
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/PaidMedia.java
@@ -64,20 +64,20 @@ public abstract class PaidMedia implements Serializable {
      * Returns this object as {@link PaidMediaPreview} if it is of that type, null otherwise.
      */
     public PaidMediaPreview asPreview() {
-        return this instanceof PaidMediaPreview ? (PaidMediaPreview) this : null;
+        return this instanceof PaidMediaPreview preview ? preview : null;
     }
 
     /**
      * Returns this object as {@link PaidMediaPhoto} if it is of that type, null otherwise.
      */
     public PaidMediaPhoto asPhoto() {
-        return this instanceof PaidMediaPhoto ? (PaidMediaPhoto) this : null;
+        return this instanceof PaidMediaPhoto photo ? photo : null;
     }
 
     /**
      * Returns this object as {@link PaidMediaVideo} if it is of that type, null otherwise.
      */
     public PaidMediaVideo asVideo() {
-        return this instanceof PaidMediaVideo ? (PaidMediaVideo) this : null;
+        return this instanceof PaidMediaVideo video ? video : null;
     }
 }
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/payments/RevenueWithdrawalState.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/payments/RevenueWithdrawalState.java
index b7d75c4a2813..819d067b6dd5 100644
--- a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/payments/RevenueWithdrawalState.java
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/payments/RevenueWithdrawalState.java
@@ -66,20 +66,20 @@ public abstract class RevenueWithdrawalState implements Serializable {
      * Returns this object as {@link RevenueWithdrawalStatePending} if it is of that type, null otherwise.
      */
     public RevenueWithdrawalStatePending asPending() {
-        return this instanceof RevenueWithdrawalStatePending ? (RevenueWithdrawalStatePending) this : null;
+        return this instanceof RevenueWithdrawalStatePending pending ? pending : null;
     }
 
     /**
      * Returns this object as {@link RevenueWithdrawalStateSucceeded} if it is of that type, null otherwise.
      */
     public RevenueWithdrawalStateSucceeded asSucceeded() {
-        return this instanceof RevenueWithdrawalStateSucceeded ? (RevenueWithdrawalStateSucceeded) this : null;
+        return this instanceof RevenueWithdrawalStateSucceeded succeeded ? succeeded : null;
     }
 
     /**
      * Returns this object as {@link RevenueWithdrawalStateFailed} if it is of that type, null otherwise.
      */
     public RevenueWithdrawalStateFailed asFailed() {
-        return this instanceof RevenueWithdrawalStateFailed ? (RevenueWithdrawalStateFailed) this : null;
+        return this instanceof RevenueWithdrawalStateFailed failed ? failed : null;
     }
 }
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/payments/TransactionPartner.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/payments/TransactionPartner.java
index fa51bb71762c..2dd0aae4150e 100644
--- a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/payments/TransactionPartner.java
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/payments/TransactionPartner.java
@@ -69,48 +69,48 @@ public abstract class TransactionPartner implements Serializable {
      * Returns this object as {@link TransactionPartnerUser} if it is of that type, null otherwise.
      */
     public TransactionPartnerUser asUser() {
-        return this instanceof TransactionPartnerUser ? (TransactionPartnerUser) this : null;
+        return this instanceof TransactionPartnerUser user ? user : null;
     }
 
     /**
      * Returns this object as {@link TransactionPartnerChat} if it is of that type, null otherwise.
      */
     public TransactionPartnerChat asChat() {
-        return this instanceof TransactionPartnerChat ? (TransactionPartnerChat) this : null;
+        return this instanceof TransactionPartnerChat chat ? chat : null;
     }
 
     /**
      * Returns this object as {@link TransactionPartnerAffiliateProgram} if it is of that type, null otherwise.
      */
     public TransactionPartnerAffiliateProgram asAffiliateProgram() {
-        return this instanceof TransactionPartnerAffiliateProgram ? (TransactionPartnerAffiliateProgram) this : null;
+        return this instanceof TransactionPartnerAffiliateProgram affiliateProgram ? affiliateProgram : null;
     }
 
     /**
      * Returns this object as {@link TransactionPartnerFragment} if it is of that type, null otherwise.
      */
     public TransactionPartnerFragment asFragment() {
-        return this instanceof TransactionPartnerFragment ? (TransactionPartnerFragment) this : null;
+        return this instanceof TransactionPartnerFragment fragment ? fragment : null;
     }
 
     /**
      * Returns this object as {@link TransactionPartnerTelegramAds} if it is of that type, null otherwise.
      */
     public TransactionPartnerTelegramAds asTelegramAds() {
-        return this instanceof TransactionPartnerTelegramAds ? (TransactionPartnerTelegramAds) this : null;
+        return this instanceof TransactionPartnerTelegramAds telegramAds ? telegramAds : null;
     }
 
     /**
      * Returns this object as {@link TransactionPartnerTelegramApi} if it is of that type, null otherwise.
      */
     public TransactionPartnerTelegramApi asTelegramApi() {
-        return this instanceof TransactionPartnerTelegramApi ? (TransactionPartnerTelegramApi) this : null;
+        return this instanceof TransactionPartnerTelegramApi telegramApi ? telegramApi : null;
     }
 
     /**
      * Returns this object as {@link TransactionPartnerOther} if it is of that type, null otherwise.
      */
     public TransactionPartnerOther asOther() {
-        return this instanceof TransactionPartnerOther ? (TransactionPartnerOther) this : null;
+        return this instanceof TransactionPartnerOther other ? other : null;
     }
 }


(camel) 22/22: (chores): modernize instanceof checks in camel-aws2-s3

Posted by or...@apache.org.
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 94b884989c29788110751fb474cd118371a484fc
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 06:07:03 2026 +0000

    (chores): modernize instanceof checks in camel-aws2-s3
---
 .../camel/component/aws2/s3/AWS2S3Producer.java    | 28 +++++++++++-----------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
index fe1f7ebf7129..640b64679a61 100644
--- a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
+++ b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
@@ -800,8 +800,8 @@ public class AWS2S3Producer extends DefaultProducer {
 
         if (getConfiguration().isPojoRequest()) {
             Object payload = exchange.getIn().getMandatoryBody();
-            if (payload instanceof DeleteObjectsRequest) {
-                DeleteObjectsResponse result = s3Client.deleteObjects((DeleteObjectsRequest) payload);
+            if (payload instanceof DeleteObjectsRequest deleteObjectsRequest) {
+                DeleteObjectsResponse result = s3Client.deleteObjects(deleteObjectsRequest);
                 Message message = getMessageForResponse(exchange);
                 message.setBody(result);
             }
@@ -835,8 +835,8 @@ public class AWS2S3Producer extends DefaultProducer {
 
         if (getConfiguration().isPojoRequest()) {
             Object payload = exchange.getIn().getMandatoryBody();
-            if (payload instanceof RestoreObjectRequest) {
-                RestoreObjectResponse result = s3Client.restoreObject((RestoreObjectRequest) payload);
+            if (payload instanceof RestoreObjectRequest restoreObjectRequest) {
+                RestoreObjectResponse result = s3Client.restoreObject(restoreObjectRequest);
                 Message message = getMessageForResponse(exchange);
                 message.setBody(result);
             }
@@ -873,8 +873,8 @@ public class AWS2S3Producer extends DefaultProducer {
 
         if (getConfiguration().isPojoRequest()) {
             Object payload = exchange.getIn().getMandatoryBody();
-            if (payload instanceof GetObjectTaggingRequest) {
-                GetObjectTaggingResponse result = s3Client.getObjectTagging((GetObjectTaggingRequest) payload);
+            if (payload instanceof GetObjectTaggingRequest getObjectTaggingRequest) {
+                GetObjectTaggingResponse result = s3Client.getObjectTagging(getObjectTaggingRequest);
                 Message message = getMessageForResponse(exchange);
                 message.setBody(result.tagSet());
             }
@@ -899,8 +899,8 @@ public class AWS2S3Producer extends DefaultProducer {
 
         if (getConfiguration().isPojoRequest()) {
             Object payload = exchange.getIn().getMandatoryBody();
-            if (payload instanceof PutObjectTaggingRequest) {
-                PutObjectTaggingResponse result = s3Client.putObjectTagging((PutObjectTaggingRequest) payload);
+            if (payload instanceof PutObjectTaggingRequest putObjectTaggingRequest) {
+                PutObjectTaggingResponse result = s3Client.putObjectTagging(putObjectTaggingRequest);
                 Message message = getMessageForResponse(exchange);
                 message.setBody(result);
             }
@@ -937,8 +937,8 @@ public class AWS2S3Producer extends DefaultProducer {
 
         if (getConfiguration().isPojoRequest()) {
             Object payload = exchange.getIn().getMandatoryBody();
-            if (payload instanceof DeleteObjectTaggingRequest) {
-                DeleteObjectTaggingResponse result = s3Client.deleteObjectTagging((DeleteObjectTaggingRequest) payload);
+            if (payload instanceof DeleteObjectTaggingRequest deleteObjectTaggingRequest) {
+                DeleteObjectTaggingResponse result = s3Client.deleteObjectTagging(deleteObjectTaggingRequest);
                 Message message = getMessageForResponse(exchange);
                 message.setBody(result);
             }
@@ -963,8 +963,8 @@ public class AWS2S3Producer extends DefaultProducer {
 
         if (getConfiguration().isPojoRequest()) {
             Object payload = exchange.getIn().getMandatoryBody();
-            if (payload instanceof GetObjectAclRequest) {
-                GetObjectAclResponse result = s3Client.getObjectAcl((GetObjectAclRequest) payload);
+            if (payload instanceof GetObjectAclRequest getObjectAclRequest) {
+                GetObjectAclResponse result = s3Client.getObjectAcl(getObjectAclRequest);
                 Message message = getMessageForResponse(exchange);
                 message.setBody(result);
             }
@@ -989,8 +989,8 @@ public class AWS2S3Producer extends DefaultProducer {
 
         if (getConfiguration().isPojoRequest()) {
             Object payload = exchange.getIn().getMandatoryBody();
-            if (payload instanceof PutObjectAclRequest) {
-                PutObjectAclResponse result = s3Client.putObjectAcl((PutObjectAclRequest) payload);
+            if (payload instanceof PutObjectAclRequest putObjectAclRequest) {
+                PutObjectAclResponse result = s3Client.putObjectAcl(putObjectAclRequest);
                 Message message = getMessageForResponse(exchange);
                 message.setBody(result);
             }


(camel) 12/22: (chores): modernize instanceof checks in camel-neo4j

Posted by or...@apache.org.
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 0201638cde12de0654d8d7fb72ae0a55d7ff7aac
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 27 05:57:37 2026 +0000

    (chores): modernize instanceof checks in camel-neo4j
---
 .../src/main/java/org/apache/camel/component/neo4j/Neo4jProducer.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/components/camel-ai/camel-neo4j/src/main/java/org/apache/camel/component/neo4j/Neo4jProducer.java b/components/camel-ai/camel-neo4j/src/main/java/org/apache/camel/component/neo4j/Neo4jProducer.java
index 48ce18fdfd7e..fe346cd39f05 100644
--- a/components/camel-ai/camel-neo4j/src/main/java/org/apache/camel/component/neo4j/Neo4jProducer.java
+++ b/components/camel-ai/camel-neo4j/src/main/java/org/apache/camel/component/neo4j/Neo4jProducer.java
@@ -114,10 +114,10 @@ public class Neo4jProducer extends DefaultProducer {
         var query = String.format("CREATE (%s:%s $props)", alias, label);
         Map<String, Object> properties;
 
-        if (body instanceof String) {
+        if (body instanceof String bodyString) {
             try {
                 // Convert JSON string to Map for parameterized query
-                Map<String, Object> bodyMap = OBJECT_MAPPER.readValue((String) body, MAP_TYPE_REF);
+                Map<String, Object> bodyMap = OBJECT_MAPPER.readValue(bodyString, MAP_TYPE_REF);
                 properties = Map.of("props", bodyMap);
             } catch (Exception e) {
                 exchange.setException(