本文整理匯總了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;
}