org.apache.camel.dataformat.bindy
Class BindyKeyValuePairFactory

java.lang.Object
  extended by org.apache.camel.dataformat.bindy.BindyAbstractFactory
      extended by org.apache.camel.dataformat.bindy.BindyKeyValuePairFactory
All Implemented Interfaces:
BindyFactory

public class BindyKeyValuePairFactory
extends BindyAbstractFactory
implements BindyFactory

The BindyKeyValuePairFactory is the class who allows to bind data of type key value pair. Such format exist in financial messages FIX. This class allows to generate a model associated to message, bind data from a message to the POJOs, export data of POJOs to a message and format data into String, Date, Double, ... according to the format/pattern defined


Field Summary
 
Fields inherited from class org.apache.camel.dataformat.bindy.BindyAbstractFactory
crlf, mapAnnotedLinkField, models
 
Constructor Summary
BindyKeyValuePairFactory(PackageScanClassResolver resolver, String packageName)
           
 
Method Summary
 void bind(List<String> data, Map<String,Object> model)
          The bind allow to read the content of a record (expressed as a List) and map it to the model classes.
 String getKeyValuePairSeparator()
          Find the key value pair separator used to link the key with its value
 String getPairSeparator()
          Find the pair separator used to delimit the key value pair fields
 void initAnnotedFields()
          Find fields annoted in each class of the model
 void initKeyValuePairModel()
          method uses to initialize the model representing the classes who will bind the data This process will scan for classes according to the package name provided, check the classes and fields annoted.
 String unbind(Map<String,Object> model)
          The unbind is used to transform the content of the classes model objects into a string.
 
Methods inherited from class org.apache.camel.dataformat.bindy.BindyAbstractFactory
factory, getCarriageReturn, initModel, link
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.camel.dataformat.bindy.BindyFactory
initModel
 

Constructor Detail

BindyKeyValuePairFactory

public BindyKeyValuePairFactory(PackageScanClassResolver resolver,
                                String packageName)
                         throws Exception
Throws:
Exception
Method Detail

initKeyValuePairModel

public void initKeyValuePairModel()
                           throws Exception
method uses to initialize the model representing the classes who will bind the data This process will scan for classes according to the package name provided, check the classes and fields annoted. Next, we retrieve the parameters required like : Pair Separator & key value pair separator

Throws:
Exception

initAnnotedFields

public void initAnnotedFields()
Description copied from class: BindyAbstractFactory
Find fields annoted in each class of the model

Specified by:
initAnnotedFields in class BindyAbstractFactory

bind

public void bind(List<String> data,
                 Map<String,Object> model)
          throws Exception
Description copied from interface: BindyFactory
The bind allow to read the content of a record (expressed as a List) and map it to the model classes.

Specified by:
bind in interface BindyFactory
Specified by:
bind in class BindyAbstractFactory
Parameters:
data - List represents the csv, ... data to transform
model - Map is a collection of objects used to bind data. String is the the key name of the class link to POJO objects
Throws:
Exception - can be thrown

unbind

public String unbind(Map<String,Object> model)
              throws Exception
Description copied from interface: BindyFactory
The unbind is used to transform the content of the classes model objects into a string. The string represents a record of a CSV file

Specified by:
unbind in interface BindyFactory
Specified by:
unbind in class BindyAbstractFactory
Parameters:
model - Map is a collection of objects used to create csv, ... records. String is the the key name of the class link to POJO objects
Returns:
String represents a csv record created
Throws:
Exception - can be thrown

getPairSeparator

public String getPairSeparator()
Find the pair separator used to delimit the key value pair fields


getKeyValuePairSeparator

public String getKeyValuePairSeparator()
Find the key value pair separator used to link the key with its value



Copyright © 2009 Apache Software Foundation. All Rights Reserved.