Tom Tom - 7 months ago 31
Java Question

How to define a grouping separator for parsing BigDecimal numbers in Camel Bindy?

I have a CSV file that contains numbers in this format:

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
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
type instead of

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

P.S: the locale is currently set to

Tom Tom

This feature has been added to camel bindy and can be used with the following annotation variants:

@DataField(pos = x, precision = 2, pattern = "#,###.##")
private BigDecimal number;


@DataField(pos = x, precision = 2, pattern = "#,###.##", groupingSeparator = ",", decimalSeparator = ".")
private BigDecimal number;

The first variant uses the currently set locale value. If this is not set it is possible to use the second variant to specify own grouping and decimal separators.

Both variants can parse numbers like


I guess the first release containing this feature will be version 2.14.0.