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:53:01 UTC
(camel) 07/22: (chores): modernize instanceof checks in camel-langchain4j-agent-api
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.)