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

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


The following commit(s) were added to refs/heads/main by this push:
     new 46ea13aceed CAMEL-20370: Fixed generated data format configurer for 
dataformats that was mis aligned in options
46ea13aceed is described below

commit 46ea13aceed9b96f8c10af85217ab2429d6b0a59
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Fri Jan 26 12:46:45 2024 +0100

    CAMEL-20370: Fixed generated data format configurer for dataformats that 
was mis aligned in options
---
 .../beanio/BeanIODataFormatConfigurer.java         |  14 +++
 .../camel/dataformat/beanio/BeanIODataFormat.java  | 103 ++++++++++++---------
 2 files changed, 75 insertions(+), 42 deletions(-)

diff --git 
a/components/camel-beanio/src/generated/java/org/apache/camel/dataformat/beanio/BeanIODataFormatConfigurer.java
 
b/components/camel-beanio/src/generated/java/org/apache/camel/dataformat/beanio/BeanIODataFormatConfigurer.java
index 46b4f2aa7ef..d1531ea50e3 100644
--- 
a/components/camel-beanio/src/generated/java/org/apache/camel/dataformat/beanio/BeanIODataFormatConfigurer.java
+++ 
b/components/camel-beanio/src/generated/java/org/apache/camel/dataformat/beanio/BeanIODataFormatConfigurer.java
@@ -18,6 +18,20 @@ public class BeanIODataFormatConfigurer extends 
PropertyConfigurerSupport implem
     public boolean configure(CamelContext camelContext, Object target, String 
name, Object value, boolean ignoreCase) {
         BeanIODataFormat dataformat = (BeanIODataFormat) target;
         switch (ignoreCase ? name.toLowerCase() : name) {
+        case "streamname":
+        case "streamName": dataformat.setStreamName(property(camelContext, 
java.lang.String.class, value)); return true;
+        case "mapping": dataformat.setMapping(property(camelContext, 
java.lang.String.class, value)); return true;
+        case "ignoreunidentifiedrecords":
+        case "ignoreUnidentifiedRecords": 
dataformat.setIgnoreUnidentifiedRecords(property(camelContext, boolean.class, 
value)); return true;
+        case "ignoreunexpectedrecords":
+        case "ignoreUnexpectedRecords": 
dataformat.setIgnoreUnexpectedRecords(property(camelContext, boolean.class, 
value)); return true;
+        case "ignoreinvalidrecords":
+        case "ignoreInvalidRecords": 
dataformat.setIgnoreInvalidRecords(property(camelContext, boolean.class, 
value)); return true;
+        case "encoding": dataformat.setEncoding(property(camelContext, 
java.nio.charset.Charset.class, value)); return true;
+        case "beanreadererrorhandlertype":
+        case "beanReaderErrorHandlerType": 
dataformat.setBeanReaderErrorHandlerType(property(camelContext, 
java.lang.String.class, value)); return true;
+        case "unmarshalsingleobject":
+        case "unmarshalSingleObject": 
dataformat.setUnmarshalSingleObject(property(camelContext, boolean.class, 
value)); return true;
         default: return false;
         }
     }
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 1ff1892f62a..5ccf5730105 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
@@ -55,7 +55,18 @@ public class BeanIODataFormat extends ServiceSupport 
implements DataFormat, Data
 
     private transient CamelContext camelContext;
     private transient StreamFactory factory;
-    private BeanIOConfiguration configuration = new BeanIOConfiguration();
+    private transient BeanIOConfiguration configuration;
+
+    private String streamName;
+    private String mapping;
+    private boolean ignoreUnidentifiedRecords;
+    private boolean ignoreUnexpectedRecords;
+    private boolean ignoreInvalidRecords;
+    private Charset encoding = Charset.defaultCharset();
+    private Properties properties;
+    private BeanReaderErrorHandler beanReaderErrorHandler;
+    private String beanReaderErrorHandlerType;
+    private boolean unmarshalSingleObject;
 
     public BeanIODataFormat() {
     }
@@ -91,6 +102,18 @@ public class BeanIODataFormat extends ServiceSupport 
implements DataFormat, Data
         if (!ResourceHelper.isClasspathUri(getMapping())) {
             loadMappingResource();
         }
+
+        configuration = new BeanIOConfiguration();
+        configuration.setStreamName(streamName);
+        configuration.setMapping(mapping);
+        configuration.setIgnoreUnidentifiedRecords(ignoreUnidentifiedRecords);
+        configuration.setIgnoreUnexpectedRecords(ignoreUnexpectedRecords);
+        configuration.setIgnoreInvalidRecords(ignoreInvalidRecords);
+        configuration.setEncoding(encoding);
+        configuration.setProperties(properties);
+        configuration.setBeanReaderErrorHandler(beanReaderErrorHandler);
+        
configuration.setBeanReaderErrorHandlerType(beanReaderErrorHandlerType);
+        configuration.setUnmarshalSingleObject(unmarshalSingleObject);
     }
 
     @Override
@@ -204,95 +227,91 @@ public class BeanIODataFormat extends ServiceSupport 
implements DataFormat, Data
         }
     }
 
-    public String getMapping() {
-        return configuration.getMapping();
+    public void setFactory(StreamFactory factory) {
+        this.factory = factory;
     }
 
-    public void setIgnoreUnexpectedRecords(boolean ignoreUnexpectedRecords) {
-        configuration.setIgnoreUnexpectedRecords(ignoreUnexpectedRecords);
+    public String getStreamName() {
+        return streamName;
     }
 
-    public void setProperties(Properties properties) {
-        configuration.setProperties(properties);
+    public void setStreamName(String streamName) {
+        this.streamName = streamName;
     }
 
-    public void setStreamName(String streamName) {
-        configuration.setStreamName(streamName);
+    public String getMapping() {
+        return mapping;
     }
 
-    public boolean isIgnoreUnidentifiedRecords() {
-        return configuration.isIgnoreUnidentifiedRecords();
+    public void setMapping(String mapping) {
+        this.mapping = mapping;
     }
 
-    public boolean isIgnoreInvalidRecords() {
-        return configuration.isIgnoreInvalidRecords();
+    public boolean isIgnoreUnidentifiedRecords() {
+        return ignoreUnidentifiedRecords;
     }
 
-    public void setIgnoreInvalidRecords(boolean ignoreInvalidRecords) {
-        configuration.setIgnoreInvalidRecords(ignoreInvalidRecords);
+    public void setIgnoreUnidentifiedRecords(boolean 
ignoreUnidentifiedRecords) {
+        this.ignoreUnidentifiedRecords = ignoreUnidentifiedRecords;
     }
 
-    public void setEncoding(String encoding) {
-        setEncoding(Charset.forName(encoding));
+    public boolean isIgnoreUnexpectedRecords() {
+        return ignoreUnexpectedRecords;
     }
 
-    public void setEncoding(Charset encoding) {
-        if (encoding == null) {
-            throw new IllegalArgumentException("Charset encoding is null");
-        }
-        configuration.setEncoding(encoding);
+    public void setIgnoreUnexpectedRecords(boolean ignoreUnexpectedRecords) {
+        this.ignoreUnexpectedRecords = ignoreUnexpectedRecords;
     }
 
-    public boolean isIgnoreUnexpectedRecords() {
-        return configuration.isIgnoreUnexpectedRecords();
+    public boolean isIgnoreInvalidRecords() {
+        return ignoreInvalidRecords;
     }
 
-    public Properties getProperties() {
-        return configuration.getProperties();
+    public void setIgnoreInvalidRecords(boolean ignoreInvalidRecords) {
+        this.ignoreInvalidRecords = ignoreInvalidRecords;
     }
 
-    public String getStreamName() {
-        return configuration.getStreamName();
+    public Charset getEncoding() {
+        return encoding;
     }
 
-    public void setMapping(String mapping) {
-        configuration.setMapping(mapping);
+    public void setEncoding(Charset encoding) {
+        this.encoding = encoding;
     }
 
-    public void setIgnoreUnidentifiedRecords(boolean 
ignoreUnidentifiedRecords) {
-        configuration.setIgnoreUnidentifiedRecords(ignoreUnidentifiedRecords);
+    public Properties getProperties() {
+        return properties;
     }
 
-    public Charset getEncoding() {
-        return configuration.getEncoding();
+    public void setProperties(Properties properties) {
+        this.properties = properties;
     }
 
     public BeanReaderErrorHandler getBeanReaderErrorHandler() {
-        return configuration.getBeanReaderErrorHandler();
+        return beanReaderErrorHandler;
     }
 
     public void setBeanReaderErrorHandler(BeanReaderErrorHandler 
beanReaderErrorHandler) {
-        configuration.setBeanReaderErrorHandler(beanReaderErrorHandler);
+        this.beanReaderErrorHandler = beanReaderErrorHandler;
     }
 
     public String getBeanReaderErrorHandlerType() {
-        return configuration.getBeanReaderErrorHandlerType();
+        return beanReaderErrorHandlerType;
     }
 
     public void setBeanReaderErrorHandlerType(String 
beanReaderErrorHandlerType) {
-        
configuration.setBeanReaderErrorHandlerType(beanReaderErrorHandlerType);
+        this.beanReaderErrorHandlerType = beanReaderErrorHandlerType;
     }
 
     public void setBeanReaderErrorHandlerType(Class<?> 
beanReaderErrorHandlerType) {
-        
configuration.setBeanReaderErrorHandlerType(beanReaderErrorHandlerType);
+        this.beanReaderErrorHandlerType = beanReaderErrorHandlerType.getName();
     }
 
     public boolean isUnmarshalSingleObject() {
-        return configuration.isUnmarshalSingleObject();
+        return unmarshalSingleObject;
     }
 
     public void setUnmarshalSingleObject(boolean unmarshalSingleObject) {
-        configuration.setUnmarshalSingleObject(unmarshalSingleObject);
+        this.unmarshalSingleObject = unmarshalSingleObject;
     }
-
 }

Reply via email to