public <T> Set<Class<? extends T>> findAnotatedClasses(String scanPath, Class<? extends Annotation> annotationClass, Class<T> ofType) throws IOException {
        Set<Class<? extends T>> classes = new HashSet<Class<? extends T>>(); 
        if (scanPath.contains(".")) {
            scanPath = scanPath.replace('.', '/');
        }     
        String[] scanPaths = scanPath.split(",");
        
        String includeRegExp = buildIncludeRegExp(scanPaths);
        Set<URL> urls = resolverUrls(scanPaths);
         
        Map<String, Set<String>> annotationIndex = scanForAnnotatedClasses(urls);
        Set<String> classNames = annotationIndex.get(annotationClass.getName());
        if (classNames != null) {
            for (String className : classNames) {
                addClass(classes, includeRegExp, className, ofType, annotationClass);
            }
        }

        return classes;

    }
public < T > Set < Class < ? extends T > > findAnotatedClasses ( String scanPath , Class < ? extends Annotation > annotationClass , Class < T > ofType ) throws IOException { Set < Class < ? extends T > > classes = new HashSet < Class < ? extends T > > ( ) ; if ( scanPath . contains ( "." ) ) { scanPath = scanPath . replace ( '.' , '/' ) ; } String [ ] scanPaths = scanPath . split ( "," ) ; String includeRegExp = buildIncludeRegExp ( scanPaths ) ; Set < URL > urls = resolverUrls ( scanPaths ) ; Map < String , Set < String > > annotationIndex = scanForAnnotatedClasses ( urls ) ; Set < String > classNames = annotationIndex . get ( annotationClass . getName ( ) ) ; if ( classNames != null ) { for ( String className : classNames ) { addClass ( classes , includeRegExp , className , ofType , annotationClass ) ; } } return classes ; }
Scan classpath for packages matching scanPath for classes annotated with the supplied annotationClass that
extends or implements the supplied ofType.

@param <T>               Type of class to find
@param scanPath          Comma separated list of packages to scan for classes.
@param annotationClass   The annotation to find.
@param ofType            The type the found classes should extend or implement, set to Object if no validation is needed.

@return All classes found by scanning the classapth that extends or implements the ofType type.

@throws IOException      If exception occurred while accessing class path.
@throws IllegalStateException if class found does not extends of implement the ofType parameter or the class found could not be loaded.