IsAnnotationPresentFilter filter = new IsAnnotationPresentFilter(type);
return findAnnotatedWith(type, filter);
}
private static List<Class> findAnnotatedWith(Class<? extends Annotation> type, IsAnnotationPresentFilter filter) {
Scanner scanner = new Scanner(filter);
try {
long startTime = System.currentTimeMillis();
scanner.scanClasspath(Thread.currentThread().getContextClassLoader());
logger.debug("Scanned classpath for class annotated with annotation '" + type.getName() + "'. Found " + filter.getClasses().size() + " matches. Scan took " + (System.currentTimeMillis() - startTime) + "ms.");
} catch (IOException e) {
throw new RuntimeException("Failed to search classspath for class annotated with annotation '" + type.getName() + "'.", e);
}