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 .