static final class ClassPath.LocationInfo
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.lang.ClassLoader |
classloader |
(package private) java.io.File |
home |
Constructor and Description |
---|
LocationInfo(java.io.File home,
java.lang.ClassLoader classloader) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.io.File |
file()
Returns the file this location is from.
|
int |
hashCode() |
private void |
scan(java.io.File file,
java.util.Set<java.io.File> scannedUris,
ImmutableSet.Builder<ClassPath.ResourceInfo> builder) |
private void |
scanDirectory(java.io.File directory,
ImmutableSet.Builder<ClassPath.ResourceInfo> builder) |
private void |
scanDirectory(java.io.File directory,
java.lang.String packagePrefix,
java.util.Set<java.io.File> currentPath,
ImmutableSet.Builder<ClassPath.ResourceInfo> builder)
Recursively scan the given directory, adding resources for each file encountered.
|
private void |
scanJar(java.io.File file,
java.util.Set<java.io.File> scannedUris,
ImmutableSet.Builder<ClassPath.ResourceInfo> builder) |
private void |
scanJarFile(java.util.jar.JarFile file,
ImmutableSet.Builder<ClassPath.ResourceInfo> builder) |
ImmutableSet<ClassPath.ResourceInfo> |
scanResources()
Scans this location and returns all scanned resources.
|
ImmutableSet<ClassPath.ResourceInfo> |
scanResources(java.util.Set<java.io.File> scannedFiles)
Scans this location and returns all scanned resources.
|
java.lang.String |
toString() |
final java.io.File home
private final java.lang.ClassLoader classloader
public final java.io.File file()
public ImmutableSet<ClassPath.ResourceInfo> scanResources() throws java.io.IOException
java.io.IOException
public ImmutableSet<ClassPath.ResourceInfo> scanResources(java.util.Set<java.io.File> scannedFiles) throws java.io.IOException
This file and jar files from "Class-Path" entry in the scanned manifest files will be
added to scannedFiles
.
A file will be scanned at most once even if specified multiple times by one or multiple
jar files' "Class-Path" manifest entries. Particularly, if a jar file from the "Class-Path"
manifest entry is already in scannedFiles
, either because it was scanned earlier, or
it was intentionally added to the set by the caller, it will not be scanned again.
Note that when you call location.scanResources(scannedFiles)
, the location will
always be scanned even if scannedFiles
already contains it.
java.io.IOException
private void scan(java.io.File file, java.util.Set<java.io.File> scannedUris, ImmutableSet.Builder<ClassPath.ResourceInfo> builder) throws java.io.IOException
java.io.IOException
private void scanJar(java.io.File file, java.util.Set<java.io.File> scannedUris, ImmutableSet.Builder<ClassPath.ResourceInfo> builder) throws java.io.IOException
java.io.IOException
private void scanJarFile(java.util.jar.JarFile file, ImmutableSet.Builder<ClassPath.ResourceInfo> builder)
private void scanDirectory(java.io.File directory, ImmutableSet.Builder<ClassPath.ResourceInfo> builder) throws java.io.IOException
java.io.IOException
private void scanDirectory(java.io.File directory, java.lang.String packagePrefix, java.util.Set<java.io.File> currentPath, ImmutableSet.Builder<ClassPath.ResourceInfo> builder) throws java.io.IOException
directory
- the root of the directory to scanpackagePrefix
- resource path prefix inside classloader
for any files found
under directory
currentPath
- canonical files already visited in the current directory tree path, for
cycle eliminationjava.io.IOException
public boolean equals(@CheckForNull java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object