当前位置: 首页>>代码示例>>Java>>正文


Java ConfigurationBuilder.setInputsFilter方法代码示例

本文整理汇总了Java中org.reflections.util.ConfigurationBuilder.setInputsFilter方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationBuilder.setInputsFilter方法的具体用法?Java ConfigurationBuilder.setInputsFilter怎么用?Java ConfigurationBuilder.setInputsFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.reflections.util.ConfigurationBuilder的用法示例。


在下文中一共展示了ConfigurationBuilder.setInputsFilter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: scan

import org.reflections.util.ConfigurationBuilder; //导入方法依赖的package包/类
public static Iterable<URL> scan(String pattern) {

		// lookup from classpath
		ConfigurationBuilder rcp = new ConfigurationBuilder()//
				.setUrls(ClasspathHelper.forClassLoader())//
				.setScanners(new ResourcesScanner());
		{
			String path = pathChar.replaceFrom(pattern, '.');
			rcp.setInputsFilter(in -> (false == in.startsWith("java.")) && Wildcard.match(in, path));
		}

		Set<String> scans = new Reflections(rcp).getResources(Predicates.alwaysTrue());

		// transforms strings to urls
		return Iterables.transform(scans, res -> getURL(res));
	}
 
开发者ID:dohbot,项目名称:knives,代码行数:17,代码来源:Resources.java

示例2: getClasspathResources

import org.reflections.util.ConfigurationBuilder; //导入方法依赖的package包/类
private static Set<String> getClasspathResources(Set<String> filesExtensions)
  {
Collection<URL> classpathJars = classpathJars();
System.out.println(classpathJars.size());
classpathJars.forEach(System.out::println);
ConfigurationBuilder configuration = new ConfigurationBuilder()
              .setUrls(classpathJars)
              .setScanners(new ResourcesScanner());
      configuration.setInputsFilter(Assets::isValidResourcePath);
      Reflections reflections = new Reflections(configuration);
      Set<String> resources = reflections.getResources(getResourcePattern(filesExtensions));
      return resources;
  }
 
开发者ID:MMORPG-Prototype,项目名称:MMORPG_Prototype,代码行数:14,代码来源:Assets.java

示例3: getClasspathResources

import org.reflections.util.ConfigurationBuilder; //导入方法依赖的package包/类
public static Set<String> getClasspathResources(Set<String> filesExtensions, Predicate<String> inputsFilter)
{
	Collection<URL> classpathJars = getUsedJars();
	System.out.println(classpathJars.size());
	classpathJars.forEach(System.out::println);
	ConfigurationBuilder configuration = new ConfigurationBuilder().setUrls(classpathJars)
			.setScanners(new ResourcesScanner());
	configuration.setInputsFilter(inputsFilter);
	Reflections reflections = new Reflections(configuration);
	Set<String> resources = reflections.getResources(getResourcePattern(filesExtensions));
	return resources;
}
 
开发者ID:MMORPG-Prototype,项目名称:MMORPG_Prototype,代码行数:13,代码来源:ReflectionResourceUtils.java

示例4: searchClasses

import org.reflections.util.ConfigurationBuilder; //导入方法依赖的package包/类
/**
 * This is not entirely reliable method.
 * Maybe it would be better to rely on Spring ClassPathScanningCandidateComponentProvider
 */
public static void searchClasses(String packageName, Consumer<Class> consumer) {
    ConfigurationBuilder builder = new ConfigurationBuilder();
    builder.setScanners(new SubTypesScanner(false));
    builder.setUrls(ClasspathHelper.forPackage(packageName, LOGGER.getClass().getClassLoader()));
    builder.setInputsFilter(new FilterBuilder().includePackage(packageName));

    Reflections reflections = new Reflections(builder);

    Multimap<String, String> map = reflections.getStore().get(SubTypesScanner.class.getSimpleName());
    Set<String> types = new HashSet<>();

    for (String key : map.keySet()) {
        Collection<String> col = map.get(key);
        if (col == null) {
            continue;
        }

        for (String c : col) {
            String simpleName = c.replaceFirst(packageName + "\\.", "");
            if (simpleName.contains(".")) {
                continue;
            }

            types.add(c);
        }
    }

    for (String type : types) {
        try {
            Class clazz = Class.forName(type);
            consumer.accept(clazz);
        } catch (ClassNotFoundException e) {
            LOGGER.error("Error during loading class {}. ", type);
        }
    }
}
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:41,代码来源:ClassPathUtil.java


注:本文中的org.reflections.util.ConfigurationBuilder.setInputsFilter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。