当前位置: 首页>>代码示例>>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;未经允许,请勿转载。