org.apache.camel.dataformat.bindy
Class BindyAbstractFactory

java.lang.Object
  extended by org.apache.camel.dataformat.bindy.BindyAbstractFactory
All Implemented Interfaces:
BindyFactory
Direct Known Subclasses:
BindyCsvFactory, BindyKeyValuePairFactory

public abstract class BindyAbstractFactory
extends Object
implements BindyFactory

The BindyAbstractFactory implements what its common to all the formats supported by camel bindy


Field Summary
protected  String crlf
           
protected  Map<String,Field> mapAnnotedLinkField
           
protected  Set<Class> models
           
 
Constructor Summary
BindyAbstractFactory(PackageScanClassResolver resolver, String packageName)
           
 
Method Summary
abstract  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.
 Map<String,Object> factory()
          Factory method generating new instances of the model and adding them to a HashMap
 String getCarriageReturn()
          Find the carriage return set
abstract  void initAnnotedFields()
          Find fields annoted in each class of the model
 void initModel()
          method uses to initialize the model representing the classes who will bind the data.
 void link(Map<String,Object> model)
          Link objects together (Only 1to1 relation is allowed)
abstract  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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

models

protected Set<Class> models

mapAnnotedLinkField

protected Map<String,Field> mapAnnotedLinkField

crlf

protected String crlf
Constructor Detail

BindyAbstractFactory

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

initModel

public void initModel()
               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.

Specified by:
initModel in interface BindyFactory
Throws:
Exception

initAnnotedFields

public abstract void initAnnotedFields()
                                throws Exception
Find fields annoted in each class of the model

Throws:
Exception

bind

public abstract 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
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 abstract 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
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

link

public void link(Map<String,Object> model)
          throws Exception
Link objects together (Only 1to1 relation is allowed)

Throws:
Exception

factory

public Map<String,Object> factory()
                           throws Exception
Factory method generating new instances of the model and adding them to a HashMap

Returns:
Map is a collection of the objects used to bind data from records, messages
Throws:
Exception - can be thrown

getCarriageReturn

public String getCarriageReturn()
Find the carriage return set



Copyright © 2009 Apache Software Foundation. All Rights Reserved.