code: public static Set<Class<?>> scanForAnnotatedClasses(final File directory,
  		final String packagePath, final Class<? extends Annotation> annotationClass)
  		throws ClassNotFoundException
  	{
  		final Set<Class<?>> foundClasses = new HashSet<>();
  		if (!directory.exists())
  		{
  			return foundClasses;
  		}
  		// define the include filefilter for class files...
  		final FileFilter includeFileFilter = new ClassFileFilter();
  		final File[] files = directory.listFiles(includeFileFilter);
  		for (final File file : files)
  		{
  			String qualifiedClassname = null;
  			if (file.isDirectory())
  			{
  				qualifiedClassname = packagePath + "." + file.getName();
  				foundClasses
  					.addAll(scanForAnnotatedClasses(file, qualifiedClassname, annotationClass));
  			}
  			else
  			{
  				final String filename = FilenameExtensions.getFilenameWithoutExtension(file);
  				qualifiedClassname = packagePath + '.' + filename;
  				Class<?> foundClass = null;
  				try
  				{
  					foundClass = ClassExtensions.forName(qualifiedClassname);
  					if (annotationClass != null)
  					{
  						if (foundClass.isAnnotationPresent(annotationClass))
  						{
  							foundClasses.add(foundClass);
  						}
  					}
  					else
  					{
  						foundClasses.add(foundClass);
  					}
  
  				}
  				catch (final Throwable throwable)
  				{
  					foundClass = Class.forName(qualifiedClassname, false,
  						ClassExtensions.getClassLoader());
  					if (annotationClass != null)
  					{
  						if (foundClass.isAnnotationPresent(annotationClass))
  						{
  							foundClasses.add(foundClass);
  						}
  					}
  					else
  					{
  						foundClasses.add(foundClass);
  					}
  				}
  			}
  		}
  		return foundClasses;
  	}
docs: Scan recursive for annotated classes in the given directory.
  
  @param directory
  the directory
  @param packagePath
  the package path
  @param annotationClass
  the annotation class
  @return the list
  @throws ClassNotFoundException
  occurs if a given class cannot be located by the specified class loader