Class ClasspathOrder
java.lang.Object
nonapi.io.github.classgraph.classpath.ClasspathOrder
A class to find the unique ordered classpath elements.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A classpath element and theClassLoader
it was obtained from. -
Field Summary
FieldsModifier and TypeFieldDescriptionSuffixes for automatic package roots, e.g.Unique classpath entries.private final List
<ClasspathOrder.ClasspathEntry> The classpath order.private final ScanSpec
The scan spec.private static final Pattern
Match URL schemes (must consist of at least two chars, otherwise this is Windows drive letter). -
Constructor Summary
ConstructorsConstructorDescriptionClasspathOrder
(ScanSpec scanSpec, ReflectionUtils reflectionUtils) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
addClasspathEntries
(List<Object> overrideClasspath, ClassLoader classLoader, ScanSpec scanSpec, LogNode log) Add classpath entries, separated by the system path separator character.boolean
addClasspathEntry
(Object pathElement, ClassLoader classLoader, ScanSpec scanSpec, LogNode log) Add a classpath element relative to a base file.private boolean
addClasspathEntry
(Object pathElement, String pathElementStr, ClassLoader classLoader, ScanSpec scanSpec) Add a classpath entry.boolean
addClasspathEntryObject
(Object pathObject, ClassLoader classLoader, ScanSpec scanSpec, LogNode log) Add classpath entries from an object obtained from reflection.boolean
addClasspathPathStr
(String pathStr, ClassLoader classLoader, ScanSpec scanSpec, LogNode log) Add classpath entries, separated by the system path separator character.(package private) boolean
addSystemClasspathEntry
(String pathEntry, ClassLoader classLoader) Add a system classpath entry.private boolean
Test to see if a classpath element has been filtered out by the user.Get the unique classpath entry strings.getOrder()
Get the order of classpath elements, uniquified and in order.
-
Field Details
-
scanSpec
The scan spec. -
reflectionUtils
-
classpathEntryUniqueResolvedPaths
Unique classpath entries. -
order
-
AUTOMATIC_PACKAGE_ROOT_SUFFIXES
Suffixes for automatic package roots, e.g. "!/BOOT-INF/classes". -
schemeMatcher
Match URL schemes (must consist of at least two chars, otherwise this is Windows drive letter).
-
-
Constructor Details
-
ClasspathOrder
ClasspathOrder(ScanSpec scanSpec, ReflectionUtils reflectionUtils) Constructor.- Parameters:
scanSpec
- the scan spec
-
-
Method Details
-
getOrder
Get the order of classpath elements, uniquified and in order.- Returns:
- the classpath order.
-
getClasspathEntryUniqueResolvedPaths
Get the unique classpath entry strings.- Returns:
- the classpath entry strings.
-
filter
Test to see if a classpath element has been filtered out by the user.- Parameters:
classpathElementURL
- the classpath element URLclasspathElementPath
- the classpath element path- Returns:
- true, if not filtered out
-
addSystemClasspathEntry
Add a system classpath entry.- Parameters:
pathEntry
- the system classpath entry -- the path string should already have been run through FastPathResolver.resolve(FileUtils.currDirPath(), path)classLoader
- the classloader- Returns:
- true, if added and unique
-
addClasspathEntry
private boolean addClasspathEntry(Object pathElement, String pathElementStr, ClassLoader classLoader, ScanSpec scanSpec) Add a classpath entry. -
addClasspathEntry
public boolean addClasspathEntry(Object pathElement, ClassLoader classLoader, ScanSpec scanSpec, LogNode log) Add a classpath element relative to a base file. May be called by a ClassLoaderHandler to add classpath elements that it knows about. ClassLoaders will be called in order.- Parameters:
pathElement
- theString
path,URL
orURI
of the classpath element, or some object whoseObject.toString()
method can be called to obtain the classpath element.classLoader
- the ClassLoader that this classpath element was obtained from.scanSpec
- the scan speclog
- the LogNode instance to use if logging in verbose mode.- Returns:
- true (and add the classpath element) if pathElement is not null, empty, nonexistent, or filtered out by user-specified criteria, otherwise return false.
-
addClasspathEntries
public boolean addClasspathEntries(List<Object> overrideClasspath, ClassLoader classLoader, ScanSpec scanSpec, LogNode log) Add classpath entries, separated by the system path separator character.- Parameters:
overrideClasspath
- a list of delimited pathString
,URL
,URI
orFile
objects.classLoader
- the ClassLoader that this classpath was obtained from.scanSpec
- the scan speclog
- the LogNode instance to use if logging in verbose mode.- Returns:
- true (and add the classpath element) if pathElement is not null or empty, otherwise return false.
-
addClasspathPathStr
public boolean addClasspathPathStr(String pathStr, ClassLoader classLoader, ScanSpec scanSpec, LogNode log) Add classpath entries, separated by the system path separator character.- Parameters:
pathStr
- the delimited string of URLs or paths of the classpath.classLoader
- the ClassLoader that this classpath was obtained from.scanSpec
- the scan speclog
- the LogNode instance to use if logging in verbose mode.- Returns:
- true (and add the classpath element) if pathElement is not null or empty, otherwise return false.
-
addClasspathEntryObject
public boolean addClasspathEntryObject(Object pathObject, ClassLoader classLoader, ScanSpec scanSpec, LogNode log) Add classpath entries from an object obtained from reflection. The object may be aURL
, aURI
, aFile
, aPath
or aString
(containing a single classpath element path, or several paths separated with File.pathSeparator), a List or other Iterable, or an array object. In the case of Iterables and arrays, the elements may be any type whosetoString()
method returns a path or URL string (including theURL
andPath
types).- Parameters:
pathObject
- the object containing a classpath string or strings.classLoader
- the ClassLoader that this classpath was obtained from.scanSpec
- the scan speclog
- the LogNode instance to use if logging in verbose mode.- Returns:
- true (and add the classpath element) if pathEl)ement is not null or empty, otherwise return false.
-