h2. Bindy

*Available as of Camel 2.0*

The idea that the developers have followed to design this component was to allow the binding of non structured data (or to be more precise non-XML data) 
to Java Bean using annotations. Using Bindy, you can bind data like :
- CSV record,
- Fixedlength record,
- or any other non-structured data

to one or many POJOS and to convert the data according to the type of the java property. POJOS can be linked together. Moreover, for data type like Date, Double, Float, Integer, Short, Long and BigDecimal, you can provide the pattern to apply during the formatting of the property. 

For the BigDecimal number, you can also define the precision and the decimal or grouping separators

||Type||Format Type||Pattern example||Link||
|Date|DateFormat|"dd-MM-yyyy"|[http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html]|
|Decimal*|Decimalformat|"##.###.###"|[http://java.sun.com/j2se/1.5.0/docs/api/java/text/DecimalFormat.html]|

Decimal* = Double, Integer, Float, Short, Long

{note:title=Be careful}This first release only support CSV record.{note} 

To work with camel-bindy, you must first define your model in a package (e.g. com.acme.model) and for each model class (e.g. Order, Client, Instrument, ...), associate the required annotations with Class or property name.

h4. Annotations definition

{table class='confluenceTable'}
{table-row:class=confluenceTh}
{tr}Some content{tr}
{td}dfdfd{td}
{table-row}
{table}


||Annotation name||Level||Parameter||
|CsvRecord|Class|Name : separator
type : string
value : ',' or ';' or ...|

This annotation must be declared one time and is associated to the root class of the model. If the record represents orders, then this annotation is added to the Order class like this : 
@CsvRecord( separator = "," )
public Class Order

|CsvRecord|Class|Name : separator, type : string, value : ',' or ';' or ...|


h3. Using the Java DSL

For example the following uses a named DataFormat of _bindy_ which is configured with a number of Java package names to initialize the model objects.

{code}
DataFormat bindy = new CsvBindyDataFormat("com.acme.model");

from("file://inbox").
  unmarshal(bindy).
  to("bean:handleOrder");
{code}

You can if you prefer use a named reference to a data format which can then be defined in your [Registry] such as via your [Spring] XML file. e.g. 

{code}
from("file://inbox").
  unmarshal("myBindyDataFormat").
  to("bean:handleOrder");
{code}


h3. Using Spring XML
TODO:

h3. Dependencies

To use Bindy in your camel routes you need to add the a dependency on *camel-bindy* which implements this data format. 

If you use maven you could just add the following to your pom.xml, substituting the version number for the latest & greatest release (see [the download page for the latest versions|Download]).

{code}
<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-bindy</artifactId>
  <version>2.0.0</version>
</dependency>
{code}