Package org.reflections.util

Examples of org.reflections.util.ConfigurationBuilder


            }

            // Check if there are complements via annotations
            if (d.getPackagesToScan() != null) {
                for (String pack : d.getPackagesToScan()) {
                    Reflections reflections = new Reflections(new ConfigurationBuilder().setUrls(
                        ClasspathHelper.forPackage(pack)).setScanners(new MethodAnnotationsScanner()));

                    Set<Method> annotated = reflections.getMethodsAnnotatedWith(Documentation.class);

                    Iterator<Method> it = annotated.iterator();
View Full Code Here


   *            upon
   * @return The constructed Reflections object
   */
  public static Reflections getReflections(ClassLoader classLoader) {
    Reflections.log=null;
    Reflections reflections = new Reflections(new ConfigurationBuilder().addClassLoader(classLoader)
      .setUrls(ClasspathHelper.forClassLoader(new ClassLoader[] { classLoader }))
      .setScanners(new TypeAnnotationsScanner()));
    return reflections;
  }
View Full Code Here

            }

            // Check if there are complements via annotations
            if (d.getPackagesToScan() != null) {
                for (String pack : d.getPackagesToScan()) {
                    Reflections reflections = new Reflections(new ConfigurationBuilder().setUrls(
                        ClasspathHelper.forPackage(pack)).setScanners(new MethodAnnotationsScanner()));

                    Set<Method> annotated = reflections.getMethodsAnnotatedWith(Documentation.class);

                    Iterator<Method> it = annotated.iterator();
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

        H = new HashMap<Class<?>, Handler<?>>();
        registerHandlersFromPackage(DemFileHeaderHandler.class.getPackage().getName());
    }
   
    public static void registerHandlersFromPackage(String packageName) {
        Reflections reflections = new Reflections(new ConfigurationBuilder()
            .setUrls(ClasspathHelper.forPackage(packageName))
            .setScanners(new TypeAnnotationsScanner())
            );

        for (Class<?> clazz : reflections.getTypesAnnotatedWith(RegisterHandler.class)) {
View Full Code Here

  private Reflections reflections;

  public AutoConfig(String... basePackages) {
    Preconditions.checkArgument(basePackages.length > 0);
   
    ConfigurationBuilder cfgBldr = new ConfigurationBuilder();
    FilterBuilder filterBuilder = new FilterBuilder();
    for (String basePkg : basePackages) {
      cfgBldr.addUrls(ClasspathHelper.forPackage(basePkg));
      filterBuilder.include(FilterBuilder.prefix(basePkg));
    }

    cfgBldr.filterInputsBy(filterBuilder).setScanners(
        new SubTypesScanner(), new TypeAnnotationsScanner());
    this.reflections = new Reflections(cfgBldr);
  }
View Full Code Here

            jarURLs.add(jar.toURI().toURL());
        }

        // Scan classes and all jars
        final List<String> candidates = new ArrayList<String>();
        new Reflections(new ConfigurationBuilder().
                addUrls(jarURLs).setScanners(new AbstractScanner() {
            @Override
            public void scan(Object cls) {
                if ((cls instanceof ClassFile)) {
                    ClassFile classFile = (ClassFile) cls;
View Full Code Here

      log.debug("Adding package to JSONDoc recursive scan: " + pkg);
      urls.addAll(ClasspathHelper.forPackage(pkg));
      filter.includePackage(pkg);
    }

    reflections = new Reflections(new ConfigurationBuilder()
      .filterInputsBy(filter)
      .setUrls(urls)
      );
   
    JSONDoc apiDoc = new JSONDoc(version, basePath);
View Full Code Here

    return map;
  }

  private static Reflections getReflections(){
    if(REFLECTIONS == null){
      REFLECTIONS = new Reflections(new ConfigurationBuilder().setUrls(getMarkedPaths()).setScanners(subTypeScanner, annotationsScanner, resourcesScanner));
    }
    return REFLECTIONS;
  }
View Full Code Here

    /**
     * a convenient constructor for scanning within a package prefix
     * <p>if no scanners supplied, TypeAnnotationsScanner and SubTypesScanner are used by default
     */
    public Reflections(final String prefix, final Scanner... scanners) {
        this(new ConfigurationBuilder() {
            final Predicate<String> filter = new FilterBuilder.Include(FilterBuilder.prefix(prefix));

            {
                filterInputsBy(filter);
                setUrls(ClasspathHelper.getUrlsForPackagePrefix(prefix));
View Full Code Here

TOP

Related Classes of org.reflections.util.ConfigurationBuilder

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.