本文整理汇总了Java中org.reflections.util.FilterBuilder.includePackage方法的典型用法代码示例。如果您正苦于以下问题:Java FilterBuilder.includePackage方法的具体用法?Java FilterBuilder.includePackage怎么用?Java FilterBuilder.includePackage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.reflections.util.FilterBuilder
的用法示例。
在下文中一共展示了FilterBuilder.includePackage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ReflectionsServiceDiscovery
import org.reflections.util.FilterBuilder; //导入方法依赖的package包/类
public ReflectionsServiceDiscovery(String resourceSearchPackages, JsonServiceLocator locator) {
this.locator = locator;
ConfigurationBuilder builder = new ConfigurationBuilder();
PreconditionUtil.assertNotNull("no resourceSearchPackage configured", resourceSearchPackages);
FilterBuilder filter = new FilterBuilder();
for (String resourceSearchPackage : resourceSearchPackages.split(",")) {
builder = builder.addUrls(ClasspathHelper.forPackage(resourceSearchPackage));
filter.includePackage(resourceSearchPackage);
}
filter.includePackage(Repository.class.getPackage().getName());
filter.includePackage(ResourceRepository.class.getPackage().getName());
builder = builder.filterInputsBy(filter);
builder = builder.addUrls(ClasspathHelper.forClass(Repository.class));
builder = builder.addUrls(ClasspathHelper.forClass(ResourceRepository.class));
builder = builder.addUrls(ClasspathHelper.forClass(ResourceRepositoryV2.class));
builder = builder.setScanners(new SubTypesScanner(false), new TypeAnnotationsScanner());
reflections = new Reflections(builder);
}
示例2: scan
import org.reflections.util.FilterBuilder; //导入方法依赖的package包/类
public static ApiDocumentation scan(String version, String path, List<String> packages) {
Set<URL> urls = new HashSet<URL>();
FilterBuilder filter = new FilterBuilder();
log.debug("Scanning {} package(s)...", packages.size());
for(String pkg : packages) {
urls.addAll(ClasspathHelper.forPackage(pkg));
filter.includePackage(pkg);
}
Reflections reflections = new Reflections(new ConfigurationBuilder()
.filterInputsBy(filter).setUrls(urls));
ApiDocumentation apiDoc = new ApiDocumentation(version, path);
apiDoc.setRepositories(scanApiRepository(reflections.getTypesAnnotatedWith
(ApiRepository.class)));
apiDoc.setModels(scanApiModel(reflections.getTypesAnnotatedWith
(ApiModel.class)));
return apiDoc;
}