public ResourceList getResourcesMatchingPattern ( final Pattern pattern ) { if ( closed . get ( ) ) { throw new IllegalArgumentException ( "Cannot use a ScanResult after it has been closed" ) ; } final ResourceList allWhitelistedResources = getAllResources ( ) ; if ( allWhitelistedResources . isEmpty ( ) ) { return ResourceList . EMPTY_LIST ; } else { final ResourceList filteredResources = new ResourceList ( ) ; for ( final Resource classpathResource : allWhitelistedResources ) { final String relativePath = classpathResource . getPath ( ) ; if ( pattern . matcher ( relativePath ) . matches ( ) ) { filteredResources . add ( classpathResource ) ; } } return filteredResources ; } }
Get the list of all resources found in whitelisted packages that have a path matching the requested pattern .