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


Java ConfigurationBuilder.build方法代碼示例

本文整理匯總了Java中org.reflections.util.ConfigurationBuilder.build方法的典型用法代碼示例。如果您正苦於以下問題:Java ConfigurationBuilder.build方法的具體用法?Java ConfigurationBuilder.build怎麽用?Java ConfigurationBuilder.build使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.reflections.util.ConfigurationBuilder的用法示例。


在下文中一共展示了ConfigurationBuilder.build方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: configure

import org.reflections.util.ConfigurationBuilder; //導入方法依賴的package包/類
@Override
    public ReflectionsWrapper configure() {
        reflections = (Reflections) cache.get(Reflections.class.getName());

        if (reflections == null) {
            ConfigurationBuilder cb = new ConfigurationBuilder();

            Set<URL> classLocations = new LinkedHashSet<>();

            try {
                List<URL> urls = Collections.list(Thread.currentThread().getContextClassLoader().getResources(""));

                for (URL url : urls) {
                    if (url.getPath().contains("/geemvc/target/")) {
                        classLocations.add(url);
                    }
                }
            } catch (IOException e) {
                throw new IllegalStateException(e);
            }

            cb = cb.addUrls(classLocations).addClassLoader(Thread.currentThread().getContextClassLoader());
            cb = cb.setScanners(new ResourcesScanner(), new TypeAnnotationsScanner(), new MethodAnnotationsScanner(), new SubTypesScanner());
            reflections = cb.build();

//            Reflections cachedReflections = (Reflections)
              cache.putIfAbsent(Reflections.class.getName(), reflections);

//            if (cachedReflections != null)
//                reflections = cachedReflections;
        }

        return this;
    }
 
開發者ID:geetools,項目名稱:geeMVC-Java-MVC-Framework,代碼行數:35,代碼來源:TestReflectionsWrapper.java

示例2: getConfigurationBuilder

import org.reflections.util.ConfigurationBuilder; //導入方法依賴的package包/類
private static Configuration getConfigurationBuilder() {
  ConfigurationBuilder configurationBuilder=  ConfigurationBuilder.build("org.apache.gobblin.metastore.database",
      effectiveClassPathUrls(DatabaseJobHistoryStore.class.getClassLoader()));
  List<URL> filteredUrls = Lists.newArrayList(Iterables.filter(configurationBuilder.getUrls(), new Predicate<URL>() {
    @Override
    public boolean apply(@Nullable URL input) {
      return input != null && (!input.getProtocol().equals("file") || new File(input.getFile()).exists());
    }
  }));
  configurationBuilder.setUrls(filteredUrls);
  return configurationBuilder;
}
 
開發者ID:apache,項目名稱:incubator-gobblin,代碼行數:13,代碼來源:DatabaseJobHistoryStore.java

示例3: addPluginSource

import org.reflections.util.ConfigurationBuilder; //導入方法依賴的package包/類
public void addPluginSource(File file) throws InvalidPluginException {
	try {
		URL url = file.toURI().toURL();
		URLClassLoader urlClassLoader = new URLClassLoader(new URL[]{url});
		Reflections reflections = new Reflections(ConfigurationBuilder.build(urlClassLoader, url));
		workflowPluginClasses.addAll(reflections.getSubTypesOf(AlfredWorkflowPlugin.class));
		workflowPluginClasses.addAll(reflections.getSubTypesOf(AbstractWorkflowPlugin.class));
	} catch (MalformedURLException e) {
		throw new InvalidPluginException(String.format("Invalid plugin: %s.", file.getPath()), e);
	}
}
 
開發者ID:visusnet,項目名稱:alfred-worker,代碼行數:12,代碼來源:PluginManager.java

示例4: addClasses

import org.reflections.util.ConfigurationBuilder; //導入方法依賴的package包/類
public void addClasses(ClassLoader classLoader, String packageName, Class<? extends Annotation> annotation) {
	checkNotNull(classLoader);
	checkNotNull(packageName);
	checkNotNull(annotation);
	ConfigurationBuilder configurationBuilder = ConfigurationBuilder.build(packageName, classLoader);
	Reflections reflections = new Reflections(configurationBuilder);

	classes.addAll(reflections.getTypesAnnotatedWith(annotation));
}
 
開發者ID:greensopinion,項目名稱:swagger-jaxrs-maven,代碼行數:10,代碼來源:ClassCollector.java

示例5: provide

import org.reflections.util.ConfigurationBuilder; //導入方法依賴的package包/類
@Override
public Reflections provide() {
    Reflections reflections = null;

    try {
        ConfigurationBuilder cb = new ConfigurationBuilder();

        URL webappClassesPath = webappClassesPath();
        URL geemvcLibPath = geemvcLibPath();

        // TODO: Offer configuration for extra libs.
        URL gensonLibPath = gensonLibPath();

        cb = cb.addUrls(webappClassesPath, geemvcLibPath).addClassLoader(mainClassLoader());

        if (gensonLibPath != null && !isExcluded(gensonLibPath.getPath())) {
            cb = cb.addUrls(gensonLibPath);
        }

        // Add configured libraries configured.
        cb = addConfiguredIncludes(cb);

        // Give the developer a chance to add his own URLs.
        Set<URL> urls = appendURLs();
        if (urls != null && !urls.isEmpty()) {
            for (URL url : urls) {
                if (url != null) {
                    cb = cb.addUrls(url);
                }
            }
        }

        // Give the developer a chance to add his own class-loaders.
        Set<ClassLoader> classLoaders = appendClassLoaders();
        if (classLoaders != null && !classLoaders.isEmpty()) {
            cb = cb.addClassLoaders(classLoaders);
        }

        // Set all scanners. Can be changed in the extend() method if necessary.
        cb = cb.setScanners(new ResourcesScanner(), new TypeAnnotationsScanner(), new MethodAnnotationsScanner(), new SubTypesScanner());

        // Give the developer a chance to extend the ConfigurationBuilder without having to re-implement the whole class.
        extend(cb);

        // Finally build the reflections.
        reflections = cb.build();

    } catch (Exception e) {
        throw new IllegalStateException(e);
    }

    return reflections;
}
 
開發者ID:geetools,項目名稱:geeMVC-Java-MVC-Framework,代碼行數:54,代碼來源:DefaultReflectionsProvider.java


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