Class BindyFixedLengthFactory
- java.lang.Object
-
- org.apache.camel.dataformat.bindy.BindyAbstractFactory
-
- org.apache.camel.dataformat.bindy.BindyFixedLengthFactory
-
- All Implemented Interfaces:
BindyFactory
public class BindyFixedLengthFactory extends BindyAbstractFactory implements BindyFactory
The BindyFixedLengthFactory 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
annotatedLinkFields, crlf, eol, formatFactory, modelClassNames, models
-
-
Constructor Summary
Constructors Constructor Description BindyFixedLengthFactory(Class<?> type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bind(org.apache.camel.CamelContext camelContext, String recordStr, Map<String,Object> model, int line)
void
bind(org.apache.camel.CamelContext camelContext, 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. Class<?>
footer()
Gets the type of the footer record.boolean
hasFooter()
Flag indicating if we have a footerboolean
hasHeader()
Flag indicating if we have a headerClass<?>
header()
Gets the type of the header record.void
initAnnotatedFields()
Find fields annotated in each class of the modelvoid
initFixedLengthModel()
method uses to initialize the model representing the classes who will bind the data.boolean
isCountGrapheme()
Flag indicating whether graphemes or codepoints are counted.boolean
isFooter()
Flag indicating whether this factory is for a footerboolean
isHeader()
Flag indicating whether this factory is for a headerboolean
isIgnoreMissingChars()
Flag indicating whether too short lines are ignoredboolean
isIgnoreTrailingChars()
Flag indicating whether trailing characters beyond the last declared field may be ignoredchar
paddingchar()
Padding char used to fill the fieldint
recordLength()
Expected fixed length of the recordboolean
skipFooter()
Flag indicating whether to skip the footer processingboolean
skipHeader()
Flag indicating whether to skip the header parsingString
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
-
initFixedLengthModel
public void initFixedLengthModel()
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
-
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> 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 interfaceBindyFactory
- Specified by:
bind
in classBindyAbstractFactory
data
- 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
-
bind
public void bind(org.apache.camel.CamelContext camelContext, String recordStr, Map<String,Object> model, int line) throws Exception
- Throws:
Exception
-
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
-
header
public Class<?> header()
Gets the type of the header record.- Returns:
- The type of the header record if any, otherwise
void.class
.
-
hasHeader
public boolean hasHeader()
Flag indicating if we have a header
-
footer
public Class<?> footer()
Gets the type of the footer record.- Returns:
- The type of the footer record if any, otherwise
void.class
.
-
hasFooter
public boolean hasFooter()
Flag indicating if we have a footer
-
skipHeader
public boolean skipHeader()
Flag indicating whether to skip the header parsing
-
skipFooter
public boolean skipFooter()
Flag indicating whether to skip the footer processing
-
isHeader
public boolean isHeader()
Flag indicating whether this factory is for a header
-
isFooter
public boolean isFooter()
Flag indicating whether this factory is for a footer
-
paddingchar
public char paddingchar()
Padding char used to fill the field
-
recordLength
public int recordLength()
Expected fixed length of the record
-
isIgnoreTrailingChars
public boolean isIgnoreTrailingChars()
Flag indicating whether trailing characters beyond the last declared field may be ignored
-
isIgnoreMissingChars
public boolean isIgnoreMissingChars()
Flag indicating whether too short lines are ignored
-
isCountGrapheme
public boolean isCountGrapheme()
Flag indicating whether graphemes or codepoints are counted.
-
-