I have a CSV file that contains numbers in this format: 1,234.56
with ,
being the grouping separator and .
being the decimal separator. I'd like to parse that number as a BigDecimal using Camel Bindy. This is the part of the model class for this number:
@DataField(pos = 6, required = true, precision = 2, pattern = "#,###.##")
public BigDecimal value;
The problem right now is, that this will cause a java.lang.NumberFormatException
even though the correct pattern has been applied. If I remove that pattern from the annotation and the grouping separator from the number in the data file, then everything works fine. Or if I use Double
type instead of BigDecimal
.
The Camel Bindy Documentation mentions that the grouping separater for BigDecimal can be set, but the table beneath that information says that the pattern is only supported for Decimals not the BigDecimal type.
Also the source code of the used FormatFactory class shows that the pattern won't be used for BigDecimal types.
So my question is: how can I set and use a grouping separator for a BigDecimal type, like the documentation mentioned? Or is this currently not supported and I have to use Double
instead?
P.S: the locale is currently set to en_US
.