Class BindyAbstractFactory
java.lang.Object
org.apache.camel.dataformat.bindy.BindyAbstractFactory
- All Implemented Interfaces:
BindyFactory
- Direct Known Subclasses:
BindyCsvFactory
,BindyFixedLengthFactory
,BindyKeyValuePairFactory
The
BindyAbstractFactory
implements what its common to all the formats supported by Camel Bindy-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract 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. factory()
Factory method generating new instances of the model and adding them to a HashMapformatString
(Format<?> format, Object value) Format the object into a string according to the format rule definedprotected static Integer
generateKey
(Integer key1, Integer key2) Generate a unique keyFind the carriage return setstatic Object
getDefaultValueForPrimitive
(Class<?> clazz) Find the carriage return setabstract void
Find fields annotated in each class of the modelvoid
method uses to initialize the model representing the classes who will bind the data.void
Link objects togethervoid
setFormatFactory
(FormatFactory formatFactory) void
boolean
supportsModel
(Set<String> classes) Indicates whether this factory can support a row comprised of the identified classesabstract String
The unbind is used to transform the content of the classes model objects into a string.
-
Field Details
-
annotatedLinkFields
-
formatFactory
-
models
-
modelClassNames
-
crlf
-
eol
-
-
Constructor Details
-
BindyAbstractFactory
- Throws:
Exception
-
-
Method Details
-
initModel
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.- Specified by:
initModel
in interfaceBindyFactory
- Throws:
Exception
-
initAnnotatedFields
Find fields annotated in each class of the model- Throws:
Exception
-
bind
public abstract void bind(org.apache.camel.CamelContext camelContext, List<String> data, Map<String, Object> model, int line) throws ExceptionDescription 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
data
- Listrepresents the csv, ... data to transform model
- Map<String, object> is a collection of objects used to bind data. String is the key name of the class link to POJO objectsline
- is the position of the record into the file- Throws:
Exception
- can be thrown
-
unbind
public abstract String unbind(org.apache.camel.CamelContext camelContext, Map<String, Object> model) throws ExceptionDescription 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
model
- Map<String, Object> is 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
-
link
Link objects together -
factory
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
-
supportsModel
Indicates whether this factory can support a row comprised of the identified classes- Parameters:
classes
- the names of the classes in the row- Returns:
- true if the model supports the identified classes
-
generateKey
Generate a unique key- Parameters:
key1
- The key of the section numberkey2
- The key of the position of the field- Returns:
- the key generated
-
getDefaultValueForPrimitive
-
getCarriageReturn
Find the carriage return set -
getEndOfLine
Find the carriage return set -
formatString
Format the object into a string according to the format rule defined- Throws:
Exception
-
getLocale
-
setLocale
-
setFormatFactory
-