public static Set<Class<?>> findOnClassPath(ClassLoader classLoader, String packageName,
      List<Class<?>> exclusions, List<Class<?>> selectors) {

    Set<Class<?>> bindingSet = new LinkedHashSet<>();
    try {
      ClassPath classpath = ClassPath.from(classLoader);
      LOGGER.info("Checking package [{}] for binding candidates.", packageName);

      for (ClassPath.ClassInfo classInfo : classpath.getTopLevelClassesRecursive(packageName)) {
        Class<?> candidate = classInfo.load();

        if (exclusions.contains(candidate)) {
          LOGGER.debug("Candidate [{}] is excluded excluded.", candidate);
          continue;
        }

        if (isEligible(candidate, selectors)) {
          LOGGER.debug("Found class [{}]", candidate);
          bindingSet.add(candidate);
        } else {
          LOGGER.debug("Candidate [{}] doesn't match.", candidate);
        }
      }

    } catch (IOException e) {
      LOGGER.error("Failure during configuring JUICE bindings.", e);
      throw new IllegalArgumentException(e);
    }
    return bindingSet;
  }
Scans the classpath for classes based on the provided arguments

@param classLoader
         the classloader which should be used for searching.
@param packageName
         the package to be scanned
@param exclusions
         a list with classes excluded from the result
@param selectors
         a list with annotation and interface classes that identify classes
         to be found (lookup criteria)
@return a list of classes from the classpath that match the lookup criteria
ambari-server/src/main/java/org/apache/ambari/server/cleanup/ClasspathScannerUtils.java