Class BindyKeyValuePairFactory
java.lang.Object
org.apache.camel.dataformat.bindy.BindyAbstractFactory
org.apache.camel.dataformat.bindy.BindyKeyValuePairFactory
- All Implemented Interfaces:
BindyFactory
The BindyKeyValuePairFactory is the class who allows to bind data of type key value pair. Such format exist in
financial messages FIX. This class allows to generate a model associated to message, bind data from a message to the
POJOs, export data of POJOs to a message 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidbind(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. Find the key value pair separator used to link the key with its valueFind the pair separator used to delimit the key value pair fieldsvoidFind fields annotated in each class of the modelvoidmethod 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.booleanFlag indicating if the message must be orderedThe 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, supportsModelMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.camel.dataformat.bindy.BindyFactory
initModel
-
Constructor Details
-
BindyKeyValuePairFactory
- Throws:
Exception
-
-
Method Details
-
initKeyValuePairModel
public void initKeyValuePairModel()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. Next, we retrieve the parameters required like : Pair Separator & key value pair separator- Throws:
Exception
-
initAnnotatedFields
public void initAnnotatedFields()Description copied from class:BindyAbstractFactoryFind fields annotated in each class of the model- Specified by:
initAnnotatedFieldsin classBindyAbstractFactory
-
bind
public void bind(org.apache.camel.CamelContext camelContext, List<String> data, Map<String, Object> model, int line) throws ExceptionDescription copied from interface:BindyFactoryThe bind allow to read the content of a record (expressed as a List) and map it to the model classes. - Specified by:
bindin interfaceBindyFactory- Specified by:
bindin classBindyAbstractFactorydata- 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
-
bind
public void bind(List<String> data, Map<String, Object> model, int line, Map<String, throws ExceptionList<Object>> lists) - Throws:
Exception
-
unbind
public String unbind(org.apache.camel.CamelContext camelContext, Map<String, Object> model) throws ExceptionDescription copied from interface:BindyFactoryThe 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:
unbindin interfaceBindyFactory- Specified by:
unbindin classBindyAbstractFactorymodel- 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
-
getPairSeparator
Find the pair separator used to delimit the key value pair fields -
getKeyValuePairSeparator
Find the key value pair separator used to link the key with its value -
isMessageOrdered
public boolean isMessageOrdered()Flag indicating if the message must be ordered- Returns:
- boolean
-