Class URLPackageScanner


  • public class URLPackageScanner
    extends java.lang.Object
    Implementation of scanner which can scan a URLClassLoader
    • Field Detail

      • log

        private static final java.util.logging.Logger log
      • NAME_EMPTY_PACKAGE

        private static final java.lang.String NAME_EMPTY_PACKAGE
        Name of the empty package
        See Also:
        Constant Field Values
      • packageName

        private final java.lang.String packageName
      • packageNamePath

        private final java.lang.String packageNamePath
      • addRecursively

        private final boolean addRecursively
      • classLoader

        private final java.lang.ClassLoader classLoader
    • Constructor Detail

      • URLPackageScanner

        private URLPackageScanner​(java.lang.String packageName,
                                  boolean addRecursively,
                                  java.lang.ClassLoader classLoader,
                                  URLPackageScanner.Callback callback)
    • Method Detail

      • newInstance

        public static URLPackageScanner newInstance​(boolean addRecursively,
                                                    java.lang.ClassLoader classLoader,
                                                    URLPackageScanner.Callback callback,
                                                    java.lang.String packageName)
        Factory method to create an instance of URLPackageScanner.
        Parameters:
        addRecursively - flag to add child packages
        classLoader - class loader that will have classes added
        pkg - Package that will be scanned
        Returns:
        new instance of URLPackageScanner
      • newInstance

        public static URLPackageScanner newInstance​(boolean addRecursively,
                                                    java.lang.ClassLoader classLoader,
                                                    URLPackageScanner.Callback callback)
        Factory method to create an instance of URLPackageScanner in the default package
        Parameters:
        pkg - Package that will be scanned
        addRecursively - flag to add child packages
        classLoader - class loader that will have classes added
        Returns:
        new instance of URLPackageScanner
      • scanPackage

        public void scanPackage()
      • handleArchiveByFile

        private void handleArchiveByFile​(java.io.File file)
                                  throws java.io.IOException,
                                         java.lang.ClassNotFoundException
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • handle

        private void handle​(java.util.Set<java.lang.String> paths)
                     throws java.io.IOException,
                            java.lang.ClassNotFoundException
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • handle

        private void handle​(java.io.File file,
                            java.lang.String packageName)
                     throws java.lang.ClassNotFoundException
        Throws:
        java.lang.ClassNotFoundException
      • foundClass

        private void foundClass​(java.lang.String className)
      • loadResources

        private java.util.List<java.net.URL> loadResources​(java.lang.String name)
                                                    throws java.io.IOException
        Throws:
        java.io.IOException