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