...
Parameter name | type | Info |
---|---|---|
pos | int | mandatory - digit number starting from 1 to ... |
pattern | string | optional - default value = "" - will be used to format Decimal, Date, ... |
length | int | optional - represents the length of the field for fixed length format |
precision | int | optional - represents the precision to be used when the Decimal number will be formatted/parsed |
pattern | string | optional - default value = "" - is used by the Java Formater formatter (SimpleDateFormat by example) to format/validate data. If using pattern, then setting locale on bindy data format is recommended. Either set to a known locale such as "us" or use "default" to use platform default locale. Notice that "default" requires Camel 2.14/2.13.3/2.125. |
position | int | optional - must be used when the position of the field in the CSV generated must be different compare to pos |
required | boolean | optional - default value = "false" |
trim | boolean | optional - default value = "false" |
defaultValue | string | Camel 2.10: optional - default value = "" - defines the field's default value when the respective CSV field is empty/not available |
impliedDecimalSeparator | boolean | Camel 2.11: optional - default value = "false" - Indicates if there is a decimal point implied at a specified location |
lengthPos | int | Camel 2.11: optional - can be used to identify a data field in a fixed-length record that defines the fixed length for this field |
delimiter | string | Camel 2.11: optional - can be used to demarcate the end of a variable-length field within a fixed-length record |
...
For example the following uses the class BindyCsvDataFormat
(who correspond to the class associated with the CSV record type) which is configured with "com.acme.model"
package name to initialize the model objects configured in this package.
Code Block |
---|
DataFormat bindy = new BindyCsvDataFormat("com.acme.model");
|
Setting locale
Bindy supports configuring the locale on the dataformat, such as
Code Block |
---|
BindyCsvDataFormat bindy = new BindyCsvDataFormat("com.acme.model"); bindy.setLocale("us"); |
Or to use the platform default locale then use "default" as the locale name. Notice this requires Camel 2.14/2.13.3/2.12.5.
Code Block |
---|
BindyCsvDataFormat bindy = new BindyCsvDataFormat("com.acme.model");
bindy.setLocale("default"); |
for older releases you can set it using Java code as shown
Code Block |
---|
BindyCsvDataFormat bindy = new BindyCsvDataFormat("com.acme.model");
bindy.setLocale(Locale.getDefault().getISO3Country()); |
Unmarshaling
Code Block |
---|
from("file://inbox") .unmarshal(bindy) .to("direct:handleOrders"); |
...