Bindy DefaultValue is not working. Need help

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Bindy DefaultValue is not working. Need help

Amruta Jawlekar
Hi, I am using camel-bindy to put default value for some fields. But it is not populating the default values in the final csv document.

camel-context:

                        <camel:marshal>
                                <camel:bindy type="Csv" classType="integration.model.item.ItemVendorCSVRecord"/>
                        </camel:marshal>

In this class:
    @DataField(pos = 2, defaultValue = "ITEM_VENDOR")
    private String recordType;

I tried with setting empty string to this field, and not setting this field at all.
Still the generated document is not setting this default value.

When i turn on Debug, I can see below in logs -

When I set empty string--
[l-1) thread #1 - RecipientList] BindyCsvFactory                DEBUG Value to be formatted: , position: 2, and its formatted value:

When I set nothing--
[l-1) thread #1 - RecipientList] BindyCsvFactory                DEBUG Value to be formatted: null, position: 2, and its formatted value:

Please help!
Reply | Threaded
Open this post in threaded view
|

Re: Bindy DefaultValue is not working. Need help

Amruta Jawlekar
and here are pom.xml dependencies -

                <dependency>
                        <groupId>org.apache.camel</groupId>
                        <artifactId>camel-core</artifactId>
                        <version>2.17.3</version>
                </dependency>
                <dependency>
                        <groupId>org.apache.camel</groupId>
                        <artifactId>camel-spring</artifactId>
                        <version>2.17.3</version>
                </dependency>
                <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-context</artifactId>
                        <version>4.2.5.RELEASE</version>
                </dependency>
                <dependency>
                        <groupId>org.apache.camel</groupId>
                        <artifactId>camel-bindy</artifactId>
                        <version>2.17.3</version>
                </dependency>
Reply | Threaded
Open this post in threaded view
|

Re: Bindy DefaultValue is not working. Need help

Amruta Jawlekar
In reply to this post by Amruta Jawlekar
From the BindyCSVFactory code, it looks like default value is set only during unmarshalling from CSV to object. For marshalling from object to CSV, unbind method is used in which defaultvalue is not set.

Let me know if my understanding is correct.
Reply | Threaded
Open this post in threaded view
|

Re: Bindy DefaultValue is not working. Need help

Tomohisa Igarashi
Hi,

It seems to be right while it should work for marshal as well IMO. Filed a JIRA.
https://issues.apache.org/jira/browse/CAMEL-11012

Thanks,
Tomo

On 03/14/2017 05:43 PM, Amruta Jawlekar wrote:

> From the BindyCSVFactory code, it looks like default value is set only during
> unmarshalling from CSV to object. For marshalling from object to CSV, unbind
> method is used in which defaultvalue is not set.
>
> Let me know if my understanding is correct.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Bindy-DefaultValue-is-not-working-Need-help-tp5795402p5795409.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: Bindy DefaultValue is not working. Need help

Amruta Jawlekar
Thank you very much!
Reply | Threaded
Open this post in threaded view
|

Re: Bindy DefaultValue is not working. Need help

kschroeder
In reply to this post by Tomohisa Igarashi
I noticed this issue was only resolved for the CSV Factory.  How would I go about submitting a similar bug for the FixedLength factory?  It's probably a bad idea to have inconsistencies between the different factories.
Reply | Threaded
Open this post in threaded view
|

Re: Bindy DefaultValue is not working. Need help

Claus Ibsen-2
On Mon, May 22, 2017 at 7:44 PM, kschroeder <[hidden email]> wrote:
> I noticed this issue was only resolved for the CSV Factory.  How would I go
> about submitting a similar bug for the FixedLength factory?  It's probably a
> bad idea to have inconsistencies between the different factories.
>

You can create a JIRA and submit a fix via github PR
http://camel.apache.org/contributing

>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Bindy-DefaultValue-is-not-working-Need-help-tp5795402p5800037.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Reply | Threaded
Open this post in threaded view
|

Re: Bindy DefaultValue is not working. Need help

Onder SEZGIN
Logged a jira for it.

https://issues.apache.org/jira/browse/CAMEL-11313

On Mon, May 22, 2017 at 10:35 PM, Claus Ibsen <[hidden email]> wrote:

> On Mon, May 22, 2017 at 7:44 PM, kschroeder <[hidden email]>
> wrote:
> > I noticed this issue was only resolved for the CSV Factory.  How would I
> go
> > about submitting a similar bug for the FixedLength factory?  It's
> probably a
> > bad idea to have inconsistencies between the different factories.
> >
>
> You can create a JIRA and submit a fix via github PR
> http://camel.apache.org/contributing
>
> >
> >
> > --
> > View this message in context: http://camel.465427.n5.nabble.
> com/Bindy-DefaultValue-is-not-working-Need-help-tp5795402p5800037.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>