當前位置: 首頁>>代碼示例>>Java>>正文


Java FilterBuilder.includePackage方法代碼示例

本文整理匯總了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);
}
 
開發者ID:crnk-project,項目名稱:crnk-framework,代碼行數:24,代碼來源:ReflectionsServiceDiscovery.java

示例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;
	}
 
開發者ID:sebastian-ma,項目名稱:tinyspring,代碼行數:22,代碼來源:ApiScanner.java


注:本文中的org.reflections.util.FilterBuilder.includePackage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。