Class BindyCsvFactory
- java.lang.Object
-
- org.apache.camel.dataformat.bindy.BindyAbstractFactory
-
- org.apache.camel.dataformat.bindy.BindyCsvFactory
-
- All Implemented Interfaces:
BindyFactory
public class BindyCsvFactory extends BindyAbstractFactory implements BindyFactory
The BindyCsvFactory is the class who allows to : Generate a model associated to a CSV record, bind data from a record to the POJOs, export data of POJOs to a CSV 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
annotatedLinkFields, crlf, eol, formatFactory, modelClassNames, models
-
-
Constructor Summary
Constructors Constructor Description BindyCsvFactory(Class<?> type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bind(org.apache.camel.CamelContext camelContext, List<String> tokens, 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. String
generateHeader()
Generate for the first line the headers of the columnsboolean
getAutospanLine()
If last record is to span the rest of the lineboolean
getGenerateHeaderColumnNames()
Flag indicating if the first line of the CSV must be skippedint
getMaxpos()
String
getQuote()
Boolean
getRemoveQuotes()
String
getSeparator()
Find the separator used to delimit the CSV fieldsboolean
getSkipFirstLine()
Find the separator used to delimit the CSV fieldsvoid
initAnnotatedFields()
Find fields annotated in each class of the modelvoid
initCsvModel()
method uses to initialize the model representing the classes who will bind the data.boolean
isAllowEmptyStream()
boolean
isEndWithLineBreak()
boolean
isMessageOrdered()
Flag indicating if the message must be orderedboolean
isSkipField()
Indicate if can skip fieldsboolean
isTrimLine()
String
unbind(org.apache.camel.CamelContext camelContext, 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, getEndOfLine, getLocale, initModel, link, setFormatFactory, setLocale, supportsModel
-
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
-
-
-
-
Method Detail
-
initCsvModel
public void initCsvModel()
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 and retrieve the separator of the CSV record- Throws:
Exception
-
initAnnotatedFields
public void initAnnotatedFields()
Description copied from class:BindyAbstractFactory
Find fields annotated in each class of the model- Specified by:
initAnnotatedFields
in classBindyAbstractFactory
-
bind
public void bind(org.apache.camel.CamelContext camelContext, List<String> tokens, 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 interfaceBindyFactory
- Specified by:
bind
in classBindyAbstractFactory
tokens
- Listrepresents the csv, ... data to transform model
- Mapis a collection of objects used to bind data. String is 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
-
unbind
public String unbind(org.apache.camel.CamelContext camelContext, 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 interfaceBindyFactory
- Specified by:
unbind
in classBindyAbstractFactory
model
- Mapis a collection of objects used to create csv, ... records. String is the key name of the class link to POJO objects - Returns:
- String represents a csv record created
- Throws:
Exception
- can be thrown
-
generateHeader
public String generateHeader()
Generate for the first line the headers of the columns- Returns:
- the headers columns
-
getSeparator
public String getSeparator()
Find the separator used to delimit the CSV fields
-
getGenerateHeaderColumnNames
public boolean getGenerateHeaderColumnNames()
Flag indicating if the first line of the CSV must be skipped
-
getSkipFirstLine
public boolean getSkipFirstLine()
Find the separator used to delimit the CSV fields
-
isSkipField
public boolean isSkipField()
Indicate if can skip fields- Returns:
- boolean
-
getAutospanLine
public boolean getAutospanLine()
If last record is to span the rest of the line
-
isMessageOrdered
public boolean isMessageOrdered()
Flag indicating if the message must be ordered- Returns:
- boolean
-
getQuote
public String getQuote()
-
getRemoveQuotes
public Boolean getRemoveQuotes()
-
getMaxpos
public int getMaxpos()
-
isAllowEmptyStream
public boolean isAllowEmptyStream()
-
isEndWithLineBreak
public boolean isEndWithLineBreak()
-
isTrimLine
public boolean isTrimLine()
-
-