public ClassGraph whitelistPackages(final String... packageNames) {
        enableClassInfo();
        for (final String packageName : packageNames) {
            final String packageNameNormalized = WhiteBlackList.normalizePackageOrClassName(packageName);
            if (packageNameNormalized.startsWith("!") || packageNameNormalized.startsWith("-")) {
                throw new IllegalArgumentException(
                        "This style of whitelisting/blacklisting is no longer supported: " + packageNameNormalized);
            }
            // Whitelist package
            scanSpec.packageWhiteBlackList.addToWhitelist(packageNameNormalized);
            final String path = WhiteBlackList.packageNameToPath(packageNameNormalized);
            scanSpec.pathWhiteBlackList.addToWhitelist(path + "/");
            if (packageNameNormalized.isEmpty()) {
                scanSpec.pathWhiteBlackList.addToWhitelist("");
            }
            if (!packageNameNormalized.contains("*")) {
                // Whitelist sub-packages
                if (packageNameNormalized.isEmpty()) {
                    scanSpec.packagePrefixWhiteBlackList.addToWhitelist("");
                    scanSpec.pathPrefixWhiteBlackList.addToWhitelist("");
                } else {
                    scanSpec.packagePrefixWhiteBlackList.addToWhitelist(packageNameNormalized + ".");
                    scanSpec.pathPrefixWhiteBlackList.addToWhitelist(path + "/");
                }
            }
        }
        return this;
    }
public ClassGraph whitelistPackages ( final String ... packageNames ) { enableClassInfo ( ) ; for ( final String packageName : packageNames ) { final String packageNameNormalized = WhiteBlackList . normalizePackageOrClassName ( packageName ) ; if ( packageNameNormalized . startsWith ( "!" ) || packageNameNormalized . startsWith ( "-" ) ) { throw new IllegalArgumentException ( "This style of whitelisting/blacklisting is no longer supported: " + packageNameNormalized ) ; } scanSpec . packageWhiteBlackList . addToWhitelist ( packageNameNormalized ) ; final String path = WhiteBlackList . packageNameToPath ( packageNameNormalized ) ; scanSpec . pathWhiteBlackList . addToWhitelist ( path + "/" ) ; if ( packageNameNormalized . isEmpty ( ) ) { scanSpec . pathWhiteBlackList . addToWhitelist ( "" ) ; } if ( ! packageNameNormalized . contains ( "*" ) ) { if ( packageNameNormalized . isEmpty ( ) ) { scanSpec . packagePrefixWhiteBlackList . addToWhitelist ( "" ) ; scanSpec . pathPrefixWhiteBlackList . addToWhitelist ( "" ) ; } else { scanSpec . packagePrefixWhiteBlackList . addToWhitelist ( packageNameNormalized + "." ) ; scanSpec . pathPrefixWhiteBlackList . addToWhitelist ( path + "/" ) ; } } } return this ; }
Scan one or more specific packages and their sub-packages.

<p>
N.B. Automatically calls {@link #enableClassInfo()} -- call {@link #whitelistPaths(String...)} instead if you
only need to scan resources.

@param packageNames
The fully-qualified names of packages to scan (using '.' as a separator). May include a glob
wildcard ({@code '*'}).
@return this (for method chaining).