Class ClasspathOrder
- java.lang.Object
-
- io.github.lukehutch.fastclasspathscanner.utils.ClasspathOrder
-
public class ClasspathOrder extends Object
A class to find the unique ordered classpath elements.
-
-
Constructor Summary
Constructors Constructor Description ClasspathOrder(ScanSpec scanSpec, NestedJarHandler nestedJarHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addClasspathElement(String pathElement, ClassLoader[] classLoaders, ScanSpec scanSpec, LogNode log)
Add a classpath element relative to a base file.boolean
addClasspathElement(String pathElement, ClassLoader classLoader, LogNode log)
Add a classpath element relative to a base file.boolean
addClasspathElementObject(Object pathObject, ClassLoader classLoader, LogNode log)
Add classpath elements from an object obtained from reflection.boolean
addClasspathElements(String pathStr, ClassLoader[] classLoaders, LogNode log)
Add classpath elements, separated by the system path separator character.boolean
addClasspathElements(String pathStr, ClassLoader classLoader, LogNode log)
Add classpath elements, separated by the system path separator character.LinkedHashSet<ClasspathOrModulePathEntry>
get()
Get the order of classpath elements.
-
-
-
Constructor Detail
-
ClasspathOrder
public ClasspathOrder(ScanSpec scanSpec, NestedJarHandler nestedJarHandler)
-
-
Method Detail
-
get
public LinkedHashSet<ClasspathOrModulePathEntry> get()
Get the order of classpath elements.
-
addClasspathElement
public boolean addClasspathElement(String pathElement, ClassLoader[] classLoaders, 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
- the URL or path of the classpath element.classLoaders
- the ClassLoader(s) that this classpath element was obtained from.scanSpec
- the ScanSpec.log
- 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.
-
addClasspathElements
public boolean addClasspathElements(String pathStr, ClassLoader[] classLoaders, LogNode log)
Add classpath elements, separated by the system path separator character. May be called by a ClassLoaderHandler to add a path string that it knows about.- Parameters:
pathStr
- the delimited string of URLs or paths of the classpath.classLoaders
- the ClassLoader(s) that this classpath was obtained from.log
- 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.
-
addClasspathElement
public boolean addClasspathElement(String pathElement, ClassLoader classLoader, 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.- Parameters:
pathElement
- the URL or path of the classpath element.classLoader
- the ClassLoader that this classpath element was obtained from.log
- 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.
-
addClasspathElementObject
public boolean addClasspathElementObject(Object pathObject, ClassLoader classLoader, LogNode log)
Add classpath elements from an object obtained from reflection. The object may be a String (containing a single 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.log
- 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.
-
addClasspathElements
public boolean addClasspathElements(String pathStr, ClassLoader classLoader, LogNode log)
Add classpath elements, separated by the system path separator character. May be called by a ClassLoaderHandler to add a path string that it knows about.- Parameters:
pathStr
- the delimited string of URLs or paths of the classpath.classLoader
- the ClassLoader that this classpath was obtained from.log
- 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.
-
-