use of org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat in project camel by apache.
the class BindyCsvDataFormatAutoConfiguration method configureBindyCsvDataFormatFactory.
@Bean(name = "bindy-csv-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(BindyCsvDataFormat.class)
public DataFormatFactory configureBindyCsvDataFormatFactory(final CamelContext camelContext, final BindyCsvDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
BindyCsvDataFormat dataformat = new BindyCsvDataFormat();
if (CamelContextAware.class.isAssignableFrom(BindyCsvDataFormat.class)) {
CamelContextAware contextAware = CamelContextAware.class.cast(dataformat);
if (contextAware != null) {
contextAware.setCamelContext(camelContext);
}
}
try {
Map<String, Object> parameters = new HashMap<>();
IntrospectionSupport.getProperties(configuration, parameters, null, false);
IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), dataformat, parameters);
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
return dataformat;
}
};
}
Aggregations