Package org.reflections

Examples of org.reflections.Reflections


      throw new RuntimeException("Error getting JDBC connection", e);
    }
  }

  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);
      return inputStream;


  public static void scanClassPathForFormattingAnnotations() {

    ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2);

    // scan classpath and filter out classes that don't begin with "com.nds"
    Reflections ndsReflections = new Reflections("com.nds");

    Set<Class<?>> annotated = ndsReflections.getTypesAnnotatedWith(DefaultFormat.class);

        Reflections ciscoReflections = new Reflections("com.cisco");

        annotated.addAll(ciscoReflections.getTypesAnnotatedWith(DefaultFormat.class));

    for (Class<?> markerClass : annotated) {

      // if the marker class is indeed implementing FoundationLoggingMarker
      // interface

      }
      if(config.getBasePackages().length > 1) {
        throw new IllegalArgumentException("picoprovider has no support for multiple package scanning");
      }
      String packages = config.getBasePackages()[0];
        this.reflections = new Reflections(packages, new ClassAnnotationsScanner(), new SubTypesScanner());
    }

      }

      // 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();

          while (it.hasNext()) {

   * @return
   */
  private static Set<Class<? extends MZmineModule>> findModulesInPackage(
      String packages) {

    Reflections reflections = new Reflections(packages);

    Set<Class<? extends MZmineModule>> result = new HashSet<Class<? extends MZmineModule>>();

    // builds all our implementation objects
    for (Class<? extends MZmineModule> module : reflections
        .getSubTypesOf(MZmineModule.class)) {
      if (module.isInterface() == false) {
        if (module.isAnonymousClass() == false) {
          if (module.isAnnotation() == false) {
            if (module.isLocalClass() == false) {

  @Inject
  public Plugins(PluginManager pluginManager) {
    this.pluginManager = pluginManager;
    pluginList = pluginManager.loadAll();

    Reflections reflections = new Reflections("com.crawljax.core.plugin");
    basePluginClasses = reflections.getSubTypesOf(com.crawljax.core.plugin.Plugin.class);
  }

    }

    ClassLoader newClassLoader = new URLClassLoader(new URL[]{instanceURL}, Thread.currentThread().getContextClassLoader());
    Thread.currentThread().setContextClassLoader(newClassLoader);

    Reflections reflections = new Reflections(new ConfigurationBuilder()
          .addUrls(instanceURL, ClasspathHelper.forClass(com.crawljax.core.plugin.Plugin.class))
          .addClassLoader(newClassLoader));

    Set<Class<? extends com.crawljax.core.plugin.Plugin>> pluginClasses = reflections.getSubTypesOf(com.crawljax.core.plugin.Plugin.class);
    pluginClasses.removeAll(basePluginClasses);

    com.crawljax.core.plugin.Plugin instance = null;
    for(Class<? extends com.crawljax.core.plugin.Plugin> pluginClass : pluginClasses) {
      try {

            }
        };

        final String myNameSpaceToScan = getNameSpace();

        final Reflections reflections = new Reflections(new ConfigurationBuilder().filterInputsBy(
                    new FilterBuilder.Include(FilterBuilder.prefix(myNameSpaceToScan))).setUrls(
                    ClasspathHelper.forPackage(myNameSpaceToScan)).setScanners(new TypeAnnotationsScanner()
                        .filterResultsBy(filter)));
        final Set<Class<?>> objectMapper = reflections.getTypesAnnotatedWith(GlobalObjectMapper.class);

        return objectMapper;
    }

  public static void scanClassPathForFormattingAnnotations() {

    ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2);

    // scan classpath and filter out classes that don't begin with "com.nds"
    Reflections ndsReflections = new Reflections("com.nds");

    Set<Class<?>> annotated = ndsReflections.getTypesAnnotatedWith(DefaultFormat.class);

        Reflections ciscoReflections = new Reflections("com.cisco");

        annotated.addAll(ciscoReflections.getTypesAnnotatedWith(DefaultFormat.class));

    for (Class<?> markerClass : annotated) {

      // if the marker class is indeed implementing FoundationLoggingMarker
      // interface

    private final Reflections reflections;

    private ServiceLoaderImpl() {
        Predicate<String> filter = new FilterBuilder().include(FilterBuilder.prefix("configuration"));

        reflections = new Reflections(new ConfigurationBuilder().filterInputsBy(filter)
                .setUrls(ClasspathHelper.forPackage("configuration"))
                .setScanners(new TypeAnnotationsScanner(), new MethodAnnotationsScanner(), new TypesScanner()));

    }

TOP

Related Classes of org.reflections.Reflections

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.