[CAMEL-13026] Add 'CsvMarshallerFactory' and corresponding tests#2705
[CAMEL-13026] Add 'CsvMarshallerFactory' and corresponding tests#2705ribeaud wants to merge 3 commits intoapache:masterfrom ribeaud:CAMEL-13026
Conversation
| * Creates and returns a {@link CSVPrinter}. | ||
| * | ||
| * @param exchange Exchange (used for access to type conversion). Could NOT be <code>null</code>. | ||
| * @param outputStream Output stream of the CSV. Could NOT be <code>null</code>. |
There was a problem hiding this comment.
You can use objecthelper.notnull to enforce non-null values
There was a problem hiding this comment.
Thanks for the hint. There is java.util.Objects.requireNonNull since Java 1.7 as well. Personally, I would prefer assertions for potential programmatic errors like here (if the value is null, then the programmer did something wrong - not related to the environment or to the machine).
However, I am going to follow your suggestion (for consistency) and adapt the PR.
onderson
left a comment
There was a problem hiding this comment.
Minor comment(that might be applicable for a couple of more places), you can use ObjectHelper.notNull.
Apart from that, LGTM.
|
When adding new options to a data format its a little more complicated as you need to add the options to CsvDataFormat in camel-core too. |
OK, what should we do then? |
|
@ribeaud you should to change this file also https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/model/dataformat/CsvDataFormat.java |
|
Yeah as @dmvolod says we need to add the option to the model class in camel-core, and also add documentation to the option (if missing). |
|
Good morning, @dmvolod: Which commits are you referencing to? I am going to update the PR in the next hour... Regards, |
|
@ribeaud you can look at this commit for example 7b36d71#diff-3e53038b6f7e711448d3c517b7f36109 |
|
Hi, Done. On my local environment I got a bit lost regarding the documentation: should I update both csv-dataformat.adoc? Is one of them automatically generated? Anyway, have a look and let me know. Thanks and cheers and have a nice one, christian. |
|
@ribeaud run it locally and all tests passed successfully, looks like problems with your env. |
|
@davsclaus , @onderson and @oscerd are you agree to merge it? |
|
The documentation for the option could be better - dont say set or get X, but say something like to use a custom csv formatter factory for implementing your own formatter for more advanced use-cases. And likely when we regen the code it will be updated. But that is not a biggie. The option should also be labelled as an advanced option. |
|
Thanks @davsclaus , I will merge it and polish as well. |
Camel 4.8.3 branch
Hi @onderson. Here we are... Cheers,
christian