Package org.reflections.scanners

Examples of org.reflections.scanners.ResourcesScanner


        return Iterables.filter(
            new Reflections(
                new ConfigurationBuilder()
                    .setScanners(
                        new SubTypesScanner(false),
                        new ResourcesScanner()
                )
                    .setUrls(
                        ClasspathHelper.forClassLoader(
                            ClasspathHelper.contextClassLoader(),
                            ClasspathHelper.staticClassLoader()
View Full Code Here


    public static Set<Class<? extends Structure>> findSubTypesOfStructure(final Class classDeclaredInSourceTreeToSearch) {

        // use: http://code.google.com/p/reflections/

        final Reflections reflections = new Reflections(new ConfigurationBuilder()
                .setScanners(new SubTypesScanner(false /* don't exclude Object.class */), new ResourcesScanner())
                .setUrls(ClasspathHelper.forClass(classDeclaredInSourceTreeToSearch))
        );

        return reflections.getSubTypesOf(Structure.class);
    }
View Full Code Here

  }

  private static InputStream getInputStreamFromFile(String file) {
    Reflections reflections = new Reflections(new ConfigurationBuilder()
        .addUrls(ClasspathHelper.forPackage("org.pau.assetmanager"))
        .setScanners(new ResourcesScanner()));
    Set<String> resources = reflections.getResources(Pattern.compile(file));
    if (resources.size() > 0) {
      String resourceFound = resources.iterator().next().toString();
      InputStream inputStream = GenericTest.class.getClassLoader()
          .getResourceAsStream(resourceFound);
View Full Code Here

    if (name.charAt(dot + 1) == '*') {
      List<ClassLoader> classLoadersList = new LinkedList<ClassLoader>();
      classLoadersList.add(ClasspathHelper.contextClassLoader());
      classLoadersList.add(ClasspathHelper.staticClassLoader());
     
      Reflections reflections = new Reflections(new ConfigurationBuilder().setScanners(new SubTypesScanner(false /* don't exclude Object.class */), new ResourcesScanner())
          .setUrls(ClasspathHelper.forClassLoader(classLoadersList.toArray(new ClassLoader[0]))).filterInputsBy(new FilterBuilder().include(FilterBuilder.prefix(name.substring(0, dot)))));
      Set<Class<?>> classes = reflections.getSubTypesOf(Object.class);
      for (Class<?> clazz : classes) {
        name = clazz.getName();
        dot = name.lastIndexOf('.');
View Full Code Here

        List<ClassLoader> classLoadersList = new LinkedList<ClassLoader>();
        classLoadersList.add(ClasspathHelper.contextClassLoader());
        classLoadersList.add(ClasspathHelper.staticClassLoader());

        ConfigurationBuilder configuration = new ConfigurationBuilder()
                .setScanners(new SubTypesScanner(false), new ResourcesScanner())
                .setUrls(ClasspathHelper.forClassLoader(classLoadersList.toArray(new ClassLoader[classLoadersList.size()])))
                .filterInputsBy(new FilterBuilder().include(FilterBuilder.prefix(inputPackage)));

        Reflections reflections = new Reflections(configuration);
View Full Code Here

        List<ClassLoader> classLoadersList = new LinkedList<ClassLoader>();
        classLoadersList.add(ClasspathHelper.contextClassLoader());
        classLoadersList.add(ClasspathHelper.staticClassLoader());

        ConfigurationBuilder configuration = new ConfigurationBuilder()
                .setScanners(new SubTypesScanner(false), new ResourcesScanner())
                .setUrls(ClasspathHelper.forClassLoader(classLoadersList.toArray(new ClassLoader[classLoadersList.size()])))
                .filterInputsBy(new FilterBuilder().include(FilterBuilder.prefix(inputPackage)));

        Reflections reflections = new Reflections(configuration);
View Full Code Here

    public AboutDependency(URL url) {
      _url = url;
     
      FilterBuilder filter = new FilterBuilder().include(".*pom[.]properties");
      Reflections ref = new Reflections(new ResourcesScanner(), _url, WebAbout.class.getClassLoader(), filter);
      Set<String> resources = ref.getResources(new FilterBuilder().include("pom[.]properties"));
      Properties properties = new Properties();
      if (resources.size() == 1) {
        String relativePath = resources.iterator().next();
        try (URLClassLoader cl = new URLClassLoader(new URL[] {_url})) {
View Full Code Here

    public static List<RestxSpec> findSpecsIn(String location) throws IOException {
        RestxSpecLoader loader = new RestxSpecLoader(Factory.getInstance());

        Set<String> specResources = new ConfigurationBuilder()
                .setUrls(ClasspathHelper.forPackage(location))
                .setScanners(new ResourcesScanner())
                .filterInputsBy(new FilterBuilder().includePackage(location.replace('/','.')))
                .build()
                .getResources(Pattern.compile(".*\\.spec\\.yaml"));

        List<RestxSpec> loaded = Lists.newArrayList();
View Full Code Here

        }

        // now we search for real resources, but avoid duplicates, especially for the one found in sources
        for (String r : new ConfigurationBuilder()
                        .setUrls(ClasspathHelper.forPackage(packageName))
                        .setScanners(new ResourcesScanner())
                        .build()
                        .getResources(p)) {
            if (!resourcesUrls.containsKey(r) && r.startsWith(packageName.replace('.', '/'))) {
                resourcesUrls.put(r, Resources.getResource(r));
            }
View Full Code Here

TOP

Related Classes of org.reflections.scanners.ResourcesScanner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.