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