public abstract class BindyAbstractFactory extends Object implements BindyFactory
BindyAbstractFactory implements what its common to all the formats
supported by Camel Bindy| Modifier and Type | Field and Description |
|---|---|
protected Map<String,List<Field>> |
annotatedLinkFields |
protected String |
crlf |
protected FormatFactory |
formatFactory |
protected Set<String> |
modelClassNames |
protected Set<Class<?>> |
models |
| Constructor and Description |
|---|
BindyAbstractFactory(Class<?> type) |
| Modifier and Type | Method and Description |
|---|---|
abstract 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
|
Map<String,Object> |
factory()
Factory method generating new instances of the model and adding them to a
HashMap
|
String |
formatString(Format<?> format,
Object value)
Format the object into a string according to the format rule defined
|
protected static Integer |
generateKey(Integer key1,
Integer key2)
Generate a unique key
|
String |
getCarriageReturn()
Find the carriage return set
|
static Object |
getDefaultValueForPrimitive(Class<?> clazz) |
String |
getLocale() |
abstract void |
initAnnotatedFields()
Find fields annotated in each class of the model
|
void |
initModel()
method uses to initialize the model representing the classes who will
bind the data.
|
void |
link(Map<String,Object> model)
Link objects together
|
void |
setFormatFactory(FormatFactory formatFactory) |
void |
setLocale(String locale) |
boolean |
supportsModel(Set<String> classes)
Indicates whether this factory can support a row comprised of the identified classes
|
abstract String |
unbind(Map<String,Object> model)
The unbind is used to transform the content of the classes model objects
into a string.
|
protected FormatFactory formatFactory
protected String crlf
public void initModel()
throws Exception
initModel in interface BindyFactoryExceptionpublic abstract void initAnnotatedFields()
throws Exception
Exceptionpublic abstract void bind(List<String> data, Map<String,Object> model, int line) throws Exception
BindyFactorybind in interface BindyFactorydata - Listmodel - Mapline - is the position of the record into the fileException - can be thrownpublic abstract String unbind(Map<String,Object> model) throws Exception
BindyFactoryunbind in interface BindyFactorymodel - MapException - can be thrownpublic void link(Map<String,Object> model) throws Exception
Exceptionpublic Map<String,Object> factory() throws Exception
Exception - can be thrownpublic boolean supportsModel(Set<String> classes)
classes - the names of the classes in the rowprotected static Integer generateKey(Integer key1, Integer key2)
key1 - The key of the section numberkey2 - The key of the position of the fieldpublic static Object getDefaultValueForPrimitive(Class<?> clazz) throws Exception
Exceptionpublic String getCarriageReturn()
public String formatString(Format<?> format, Object value) throws Exception
Exceptionpublic String getLocale()
public void setLocale(String locale)
public void setFormatFactory(FormatFactory formatFactory)
Apache Camel