You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dm...@apache.org on 2019/01/22 16:37:50 UTC

[camel] 04/04: CAMEL-13026: Polished Closes #2705

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

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

commit b870eeb55036d220d460db5cf21c123787973da6
Author: Dmitry Volodin <dm...@gmail.com>
AuthorDate: Tue Jan 22 19:32:30 2019 +0300

    CAMEL-13026: Polished
    Closes #2705
---
 .../main/java/org/apache/camel/model/dataformat/CsvDataFormat.java | 7 ++++---
 components/camel-csv/src/main/docs/csv-dataformat.adoc             | 2 +-
 .../main/java/org/apache/camel/dataformat/csv/CsvMarshaller.java   | 1 +
 .../csv/CsvMarshalHeaderWithCustomMarshallFactoryTest.java         | 1 +
 docs/components/modules/ROOT/pages/csv-dataformat.adoc             | 4 ++--
 5 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/CsvDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/CsvDataFormat.java
index 36e7406..81c2c82 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/CsvDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/CsvDataFormat.java
@@ -85,7 +85,7 @@ public class CsvDataFormat extends DataFormatDefinition {
     private Boolean trim;
     @XmlAttribute
     private Boolean trailingDelimiter;
-    @XmlAttribute
+    @XmlAttribute @Metadata(label = "advanced")
     private String marshallerFactoryRef;
 
     // Unmarshall options
@@ -213,9 +213,10 @@ public class CsvDataFormat extends DataFormatDefinition {
     }
 
     /**
-     * Sets the <code>CsvMarshallerFactory</code> reference.
+     * Sets the implementation of the CsvMarshallerFactory interface which is able to customize marshalling/unmarshalling 
+     * behavior by extending CsvMarshaller or creating it from scratch.
      *
-     * @param marshallerFactoryRef the <code>CsvMarshallerFactory</code> reference. Could be <code>null</code>.
+     * @param marshallerFactoryRef the <code>CsvMarshallerFactory</code> reference.
      */
     public void setMarshallerFactoryRef(String marshallerFactoryRef) {
         this.marshallerFactoryRef = marshallerFactoryRef;
diff --git a/components/camel-csv/src/main/docs/csv-dataformat.adoc b/components/camel-csv/src/main/docs/csv-dataformat.adoc
index 3a1253d..8b4255f 100644
--- a/components/camel-csv/src/main/docs/csv-dataformat.adoc
+++ b/components/camel-csv/src/main/docs/csv-dataformat.adoc
@@ -42,7 +42,7 @@ The CSV dataformat supports 29 options, which are listed below.
 | ignoreHeaderCase | false | Boolean | Sets whether or not to ignore case when accessing header names.
 | trim | false | Boolean | Sets whether or not to trim leading and trailing blanks.
 | trailingDelimiter | false | Boolean | Sets whether or not to add a trailing delimiter.
-| marshallerFactoryRef |  | String | Sets the `CsvMarshallerFactory` reference.
+| marshallerFactoryRef |  | String | Sets the implementation of the CsvMarshallerFactory interface which is able to customize marshalling/unmarshalling behavior by extending CsvMarshaller or creating it from scratch.
 | lazyLoad | false | Boolean | Whether the unmarshalling should produce an iterator that reads the lines on the fly or if all the lines must be read at one.
 | useMaps | false | Boolean | Whether the unmarshalling should produce maps (HashMap)for the lines values instead of lists. It requires to have header (either defined or collected).
 | useOrderedMaps | false | Boolean | Whether the unmarshalling should produce ordered maps (LinkedHashMap) for the lines values instead of lists. It requires to have header (either defined or collected).
diff --git a/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvMarshaller.java b/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvMarshaller.java
index d2fee61..1ad903f 100644
--- a/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvMarshaller.java
+++ b/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvMarshaller.java
@@ -74,6 +74,7 @@ public abstract class CsvMarshaller {
      * @throws NoTypeConversionAvailableException if the body cannot be converted
      * @throws IOException                        if we cannot write into the given stream
      */
+    @SuppressWarnings("rawtypes")
     public void marshal(Exchange exchange, Object object, OutputStream outputStream) throws NoTypeConversionAvailableException, IOException {
         CSVPrinter printer = createPrinter(exchange, outputStream);
         try {
diff --git a/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvMarshalHeaderWithCustomMarshallFactoryTest.java b/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvMarshalHeaderWithCustomMarshallFactoryTest.java
index 0916bc4..f46921f 100644
--- a/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvMarshalHeaderWithCustomMarshallFactoryTest.java
+++ b/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvMarshalHeaderWithCustomMarshallFactoryTest.java
@@ -127,6 +127,7 @@ public class CsvMarshalHeaderWithCustomMarshallFactoryTest extends CamelTestSupp
             }
         }
 
+        @SuppressWarnings("unchecked")
         public void marshal(Exchange exchange, Object object, OutputStream outputStream) throws IOException {
             Iterator<Map<String, String>> it = (Iterator<Map<String, String>>) ObjectHelper.createIterator(object);
             synchronized (printer) {
diff --git a/docs/components/modules/ROOT/pages/csv-dataformat.adoc b/docs/components/modules/ROOT/pages/csv-dataformat.adoc
index 0f8157d..8b4255f 100644
--- a/docs/components/modules/ROOT/pages/csv-dataformat.adoc
+++ b/docs/components/modules/ROOT/pages/csv-dataformat.adoc
@@ -12,7 +12,7 @@ exported/imported by Excel.
 ### Options
 
 // dataformat options: START
-The CSV dataformat supports 28 options, which are listed below.
+The CSV dataformat supports 29 options, which are listed below.
 
 
 
@@ -42,12 +42,12 @@ The CSV dataformat supports 28 options, which are listed below.
 | ignoreHeaderCase | false | Boolean | Sets whether or not to ignore case when accessing header names.
 | trim | false | Boolean | Sets whether or not to trim leading and trailing blanks.
 | trailingDelimiter | false | Boolean | Sets whether or not to add a trailing delimiter.
+| marshallerFactoryRef |  | String | Sets the implementation of the CsvMarshallerFactory interface which is able to customize marshalling/unmarshalling behavior by extending CsvMarshaller or creating it from scratch.
 | lazyLoad | false | Boolean | Whether the unmarshalling should produce an iterator that reads the lines on the fly or if all the lines must be read at one.
 | useMaps | false | Boolean | Whether the unmarshalling should produce maps (HashMap)for the lines values instead of lists. It requires to have header (either defined or collected).
 | useOrderedMaps | false | Boolean | Whether the unmarshalling should produce ordered maps (LinkedHashMap) for the lines values instead of lists. It requires to have header (either defined or collected).
 | recordConverterRef |  | String | Refers to a custom CsvRecordConverter to lookup from the registry to use.
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
-| marshallerFactory | | String | Refers to a custom `CsvMarshallerFactory` to lookup from the registry to use.
 |===
 // dataformat options: END
 // spring-boot-auto-configure options: START