org.apache.camel.dataformat.bindy
Class BindyFixedLengthFactory

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

public class BindyFixedLengthFactory
extends BindyAbstractFactory
implements BindyFactory

The BindyCsvFactory is the class who allows to : Generate a model associated to a fixed length record, bind data from a record to the POJOs, export data of POJOs to a fixed length record 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
annotedLinkFields, crlf, models
 
Constructor Summary
BindyFixedLengthFactory(PackageScanClassResolver resolver, String... packageNames)
           
 
Method Summary
 void bind(List<String> data, Map<String,Object> model, int line)
          The bind allow to read the content of a record (expressed as a List) and map it to the model classes.
 void bind(String record, Map<String,Object> model, int line)
           
 boolean hasFooter()
          Flag indicating if we have a footer
 boolean hasHeader()
          Flag indicating if we have a header
 void initAnnotedFields()
          Find fields annotated in each class of the model
 void initFixedLengthModel()
          method uses to initialize the model representing the classes who will bind the data.
 char paddingchar()
          Padding char used to fill the field
 int recordLength()
           
 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, formatString, generateKey, getCarriageReturn, getDefaultValueForPrimitive, 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

BindyFixedLengthFactory

public BindyFixedLengthFactory(PackageScanClassResolver resolver,
                               String... packageNames)
                        throws Exception
Throws:
Exception
Method Detail

initFixedLengthModel

public void initFixedLengthModel()
                          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 annotated classes and fields

Throws:
Exception

initAnnotedFields

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

Specified by:
initAnnotedFields in class BindyAbstractFactory

bind

public void bind(List<String> data,
                 Map<String,Object> model,
                 int line)
          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
line - is the position of the record into the file
Throws:
Exception - can be thrown

bind

public void bind(String record,
                 Map<String,Object> model,
                 int line)
          throws Exception
Throws:
Exception

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

hasHeader

public boolean hasHeader()
Flag indicating if we have a header

Returns:
boolean

hasFooter

public boolean hasFooter()
Flag indicating if we have a footer

Returns:
boolean

paddingchar

public char paddingchar()
Padding char used to fill the field

Returns:
char

recordLength

public int recordLength()


Copyright © 2007-2010 IONA Open Source Community. All Rights Reserved.