public ClassGraph whitelistPackagesNonRecursive ( final String ... packageNames ) { enableClassInfo ( ) ; for ( final String packageName : packageNames ) { final String packageNameNormalized = WhiteBlackList . normalizePackageOrClassName ( packageName ) ; if ( packageNameNormalized . contains ( "*" ) ) { throw new IllegalArgumentException ( "Cannot use a glob wildcard here: " + packageNameNormalized ) ; } // Whitelist package, but not sub-packages scanSpec . packageWhiteBlackList . addToWhitelist ( packageNameNormalized ) ; scanSpec . pathWhiteBlackList . addToWhitelist ( WhiteBlackList . packageNameToPath ( packageNameNormalized ) + "/" ) ; if ( packageNameNormalized . isEmpty ( ) ) { scanSpec . pathWhiteBlackList . addToWhitelist ( "" ) ; } } return this ; }
Scan one or more specific packages without recursively scanning sub - packages unless they are themselves whitelisted .