public abstract class BindyAbstractFactory extends Object implements BindyFactory
BindyAbstractFactory
implements what its common to all the formats
supported by Camel BindyModifier 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 BindyFactory
Exception
public abstract void initAnnotatedFields() throws Exception
Exception
public abstract void bind(List<String> data, Map<String,Object> model, int line) throws Exception
BindyFactory
bind
in interface BindyFactory
data
- Listmodel
- Mapline
- is the position of the record into the fileException
- can be thrownpublic abstract String unbind(Map<String,Object> model) throws Exception
BindyFactory
unbind
in interface BindyFactory
model
- MapException
- can be thrownpublic void link(Map<String,Object> model) throws Exception
Exception
public 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
Exception
public String getCarriageReturn()
public String formatString(Format<?> format, Object value) throws Exception
Exception
public String getLocale()
public void setLocale(String locale)
public void setFormatFactory(FormatFactory formatFactory)
Apache Camel