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 a1820b681716e765871218faf834ad95027f1fa9
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Mon Jan 26 10:31:12 2026 +0000

    (chores): modernize instanceof checks in camel-beanio
---
 .../java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java  | 4 ++--
 .../main/java/org/apache/camel/dataformat/beanio/BeanIOHelper.java | 3 +--
 .../java/org/apache/camel/dataformat/beanio/BeanIOSplitter.java    | 7 +++----
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git 
a/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
 
b/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
index 293c7494ed65..abb3aed9195a 100644
--- 
a/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
+++ 
b/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
@@ -201,8 +201,8 @@ public class BeanIODataFormat extends ServiceSupport 
implements DataFormat, Data
             in.setErrorHandler(errorHandler);
             Object readObject;
             while ((readObject = in.read()) != null) {
-                if (readObject instanceof BeanIOHeader) {
-                    exchange.getOut().getHeaders().putAll(((BeanIOHeader) 
readObject).getHeaders());
+                if (readObject instanceof BeanIOHeader beanioheader) {
+                    
exchange.getOut().getHeaders().putAll(beanioheader.getHeaders());
                 }
                 results.add(readObject);
             }
diff --git 
a/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIOHelper.java
 
b/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIOHelper.java
index 2273ef9ebac2..192bab750c62 100644
--- 
a/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIOHelper.java
+++ 
b/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIOHelper.java
@@ -51,8 +51,7 @@ public final class BeanIOHelper {
         }
         // if the error handler extends BeanIOErrorHandler then its prototype 
scoped
         // and then inject the current exchange and init
-        if (answer instanceof BeanIOErrorHandler) {
-            BeanIOErrorHandler eh = (BeanIOErrorHandler) answer;
+        if (answer instanceof BeanIOErrorHandler eh) {
             eh.setConfiguration(configuration);
             eh.setExchange(exchange);
             eh.setResults(results);
diff --git 
a/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIOSplitter.java
 
b/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIOSplitter.java
index 5ef9e1feafe9..47787eff4e8b 100644
--- 
a/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIOSplitter.java
+++ 
b/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIOSplitter.java
@@ -87,11 +87,10 @@ public class BeanIOSplitter implements Expression {
         }
 
         BeanReader beanReader = null;
-        if (body instanceof WrappedFile) {
-            body = ((WrappedFile) body).getFile();
+        if (body instanceof WrappedFile wrappedfile) {
+            body = wrappedfile.getFile();
         }
-        if (body instanceof File) {
-            File file = (File) body;
+        if (body instanceof File file) {
             beanReader = factory.createReader(getStreamName(), file);
         }
         if (beanReader == null) {

Reply via email to