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