Class ClassPath.Scanner

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Set<java.io.File> scannedUris  
    • Constructor Summary

      Constructors 
      Constructor Description
      Scanner()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      private static ImmutableList<java.net.URL> getClassLoaderUrls​(java.lang.ClassLoader classloader)  
      (package private) static ImmutableMap<java.io.File,​java.lang.ClassLoader> getClassPathEntries​(java.lang.ClassLoader classloader)  
      (package private) static java.net.URL getClassPathEntry​(java.io.File jarFile, java.lang.String path)
      Returns the absolute uri of the Class-Path entry value as specified in JAR File Specification.
      (package private) static ImmutableSet<java.io.File> getClassPathFromManifest​(java.io.File jarFile, java.util.jar.Manifest manifest)
      Returns the class path URIs specified by the Class-Path manifest attribute, according to JAR File Specification.
      (package private) static ImmutableList<java.net.URL> parseJavaClassPath()
      Returns the URLs in the class path specified by the java.class.path system property.
      (package private) void scan​(java.io.File file, java.lang.ClassLoader classloader)  
      void scan​(java.lang.ClassLoader classloader)  
      protected abstract void scanDirectory​(java.lang.ClassLoader loader, java.io.File directory)
      Called when a directory is scanned for resource files.
      private void scanFrom​(java.io.File file, java.lang.ClassLoader classloader)  
      private void scanJar​(java.io.File file, java.lang.ClassLoader classloader)  
      protected abstract void scanJarFile​(java.lang.ClassLoader loader, java.util.jar.JarFile file)
      Called when a jar file is scanned for resource entries.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • scannedUris

        private final java.util.Set<java.io.File> scannedUris
    • Constructor Detail

      • Scanner

        Scanner()
    • Method Detail

      • scan

        public final void scan​(java.lang.ClassLoader classloader)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • scan

        final void scan​(java.io.File file,
                        java.lang.ClassLoader classloader)
                 throws java.io.IOException
        Throws:
        java.io.IOException
      • scanDirectory

        protected abstract void scanDirectory​(java.lang.ClassLoader loader,
                                              java.io.File directory)
                                       throws java.io.IOException
        Called when a directory is scanned for resource files.
        Throws:
        java.io.IOException
      • scanJarFile

        protected abstract void scanJarFile​(java.lang.ClassLoader loader,
                                            java.util.jar.JarFile file)
                                     throws java.io.IOException
        Called when a jar file is scanned for resource entries.
        Throws:
        java.io.IOException
      • scanFrom

        private void scanFrom​(java.io.File file,
                              java.lang.ClassLoader classloader)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • scanJar

        private void scanJar​(java.io.File file,
                             java.lang.ClassLoader classloader)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • getClassPathFromManifest

        static ImmutableSet<java.io.File> getClassPathFromManifest​(java.io.File jarFile,
                                                                   java.util.jar.Manifest manifest)
        Returns the class path URIs specified by the Class-Path manifest attribute, according to JAR File Specification. If manifest is null, it means the jar file has no manifest, and an empty set will be returned.
      • getClassPathEntries

        static ImmutableMap<java.io.File,​java.lang.ClassLoader> getClassPathEntries​(java.lang.ClassLoader classloader)
      • getClassLoaderUrls

        private static ImmutableList<java.net.URL> getClassLoaderUrls​(java.lang.ClassLoader classloader)
      • parseJavaClassPath

        static ImmutableList<java.net.URL> parseJavaClassPath()
        Returns the URLs in the class path specified by the java.class.path system property.
      • getClassPathEntry

        static java.net.URL getClassPathEntry​(java.io.File jarFile,
                                              java.lang.String path)
                                       throws java.net.MalformedURLException
        Returns the absolute uri of the Class-Path entry value as specified in JAR File Specification. Even though the specification only talks about relative urls, absolute urls are actually supported too (for example, in Maven surefire plugin).
        Throws:
        java.net.MalformedURLException