List < String > findInPackage ( Test test , String packageName ) { List < String > localClsssOrPkgs = new ArrayList < String > ( ) ; packageName = packageName . replace ( ' ' , ' ' ) ; Enumeration < URL > urls ; try { urls = classloader . getResources ( packageName ) ; // test for empty if ( ! urls . hasMoreElements ( ) ) { log . warn ( "Unable to find any resources for package '" + packageName + "'" ) ; } } catch ( IOException ioe ) { log . warn ( "Could not read package: " + packageName ) ; return localClsssOrPkgs ; } return findInPackageWithUrls ( test , packageName , urls ) ; }
Scans for classes starting at the package provided and descending into subpackages . Each class is offered up to the Test as it is discovered and if the Test returns true the class is retained .