use of org.apache.camel.dataformat.bindy.format.factories.FactoryRegistry in project camel by apache.
the class BindyAbstractDataFormat method tryToGetFactoryRegistry.
private FactoryRegistry tryToGetFactoryRegistry() {
Function<CamelContext, Registry> f = CamelContext::getRegistry;
Function<Registry, Set<FactoryRegistry>> g = r -> r.findByType(FactoryRegistry.class);
Function<Set<FactoryRegistry>, FactoryRegistry> h = factoryRegistries -> {
if (factoryRegistries.size() > 1) {
LOGGER.warn("Number of registered {}: {}", FactoryRegistry.class.getCanonicalName(), factoryRegistries.size());
}
if (factoryRegistries.iterator().hasNext()) {
return factoryRegistries.iterator().next();
} else {
return new DefaultFactoryRegistry();
}
};
return Optional.ofNullable(camelContext).map(f).map(g).map(h).orElse(new DefaultFactoryRegistry());
}
use of org.apache.camel.dataformat.bindy.format.factories.FactoryRegistry in project camel by apache.
the class BindyAbstractDataFormat method createFormatFactory.
private FormatFactory createFormatFactory() {
FormatFactory formatFactory = new FormatFactory();
FactoryRegistry factoryRegistry = createFactoryRegistry();
formatFactory.setFactoryRegistry(factoryRegistry);
return formatFactory;
}
Aggregations