use of org.apache.camel.quarkus.core.deployment.spi.RoutesBuilderClassExcludeBuildItem in project camel-quarkus by apache.
the class CamelProcessor method discoverRoutesBuilderClassNames.
@BuildStep(onlyIf = { CamelConfigFlags.RoutesDiscoveryEnabled.class })
public List<CamelRoutesBuilderClassBuildItem> discoverRoutesBuilderClassNames(CombinedIndexBuildItem combinedIndex, CamelConfig config, List<RoutesBuilderClassExcludeBuildItem> routesBuilderClassExcludes) {
final IndexView index = combinedIndex.getIndex();
Set<ClassInfo> allKnownImplementors = new HashSet<>();
allKnownImplementors.addAll(index.getAllKnownImplementors(ROUTES_BUILDER_TYPE));
allKnownImplementors.addAll(index.getAllKnownSubclasses(ROUTE_BUILDER_TYPE));
allKnownImplementors.addAll(index.getAllKnownSubclasses(ADVICE_WITH_ROUTE_BUILDER_TYPE));
final Predicate<DotName> pathFilter = new PathFilter.Builder().exclude(routesBuilderClassExcludes.stream().map(RoutesBuilderClassExcludeBuildItem::getPattern).collect(Collectors.toList())).exclude(config.routesDiscovery.excludePatterns).include(config.routesDiscovery.includePatterns).build().asDotNamePredicate();
return allKnownImplementors.stream().filter(ci -> ((ci.flags() & (Modifier.ABSTRACT | Modifier.PUBLIC)) == Modifier.PUBLIC)).map(ClassInfo::name).filter(pathFilter).map(CamelRoutesBuilderClassBuildItem::new).collect(Collectors.toList());
}
Aggregations