public ClassGraph blacklistPackages ( final String ... packageNames ) { enableClassInfo ( ) ; for ( final String packageName : packageNames ) { final String packageNameNormalized = WhiteBlackList . normalizePackageOrClassName ( packageName ) ; if ( packageNameNormalized . isEmpty ( ) ) { throw new IllegalArgumentException ( "Blacklisting the root package (\"\") will cause nothing to be scanned" ) ; } // Blacklisting always prevents further recursion, no need to blacklist sub-packages scanSpec . packageWhiteBlackList . addToBlacklist ( packageNameNormalized ) ; final String path = WhiteBlackList . packageNameToPath ( packageNameNormalized ) ; scanSpec . pathWhiteBlackList . addToBlacklist ( path + "/" ) ; if ( ! packageNameNormalized . contains ( "*" ) ) { // Blacklist sub-packages (zipfile entries can occur in any order) scanSpec . packagePrefixWhiteBlackList . addToBlacklist ( packageNameNormalized + "." ) ; scanSpec . pathPrefixWhiteBlackList . addToBlacklist ( path + "/" ) ; } } return this ; }
Prevent the scanning of one or more specific packages and their sub - packages .