You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Guillermo <gl...@tecsisa.com> on 2013/05/08 10:19:44 UTC
How to set DataField locale for Double records in camel bindy
Hi,
I have defined a CsvRecord with a DataField:
@DataField(pos = 1, required = true)
private Double price;
In the csv file this field has this format: XX,XX i.e. the decimal separator
is the ',' and the grouping separator is the '.'
If the VM is in ENGLISH locale/language, the records are not read correctly.
Example:
48,01 is read as 4801.0 in Java.
I need to set the locale for this DataField. I know that exists a parameter
to format Decimal, Date, etc., but if I can't set the locale, I don't think
it's very helpful for me in this case.
Maybe the solution is to define the field as a String and then format it
using DecimalFormat class.
Any ideas?
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-set-DataField-locale-for-Double-records-in-camel-bindy-tp5732150.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to set DataField locale for Double records in camel bindy
Posted by Guillermo <gl...@tecsisa.com>.
Hi,
I have defined these fields as a String so I am using the DecimalFormat
class to set the right locale.
This is not the best solution but temporarily i can work with it.
Regards.
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-set-DataField-locale-for-Double-records-in-camel-bindy-tp5732150p5732225.html
Sent from the Camel - Users mailing list archive at Nabble.com.