use of org.apache.camel.dataformat.barcode.BarcodeDataFormat in project camel by apache.
the class BarcodeDataFormatAutoConfiguration method configureBarcodeDataFormatFactory.
@Bean(name = "barcode-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(BarcodeDataFormat.class)
public DataFormatFactory configureBarcodeDataFormatFactory(final CamelContext camelContext, final BarcodeDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
BarcodeDataFormat dataformat = new BarcodeDataFormat();
if (CamelContextAware.class.isAssignableFrom(BarcodeDataFormat.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