Class ClasspathOrder
- java.lang.Object
-
- nonapi.io.github.classgraph.classpath.ClasspathOrder
-
public class ClasspathOrder extends java.lang.Object
A class to find the unique ordered classpath elements.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addClasspathElement(java.lang.String pathElement, java.lang.ClassLoader classLoader, LogNode log)
Add a classpath element relative to a base file.boolean
addClasspathElementObject(java.lang.Object pathObject, java.lang.ClassLoader classLoader, LogNode log)
Add classpath elements from an object obtained from reflection.boolean
addClasspathElements(java.lang.String pathStr, java.lang.ClassLoader[] classLoaders, LogNode log)
Add classpath elements, separated by the system path separator character.boolean
addClasspathElements(java.lang.String pathStr, java.lang.ClassLoader classLoader, LogNode log)
Add classpath elements, separated by the system path separator character.boolean
addClasspathElements(ClasspathOrder subsequentOrder)
Add all classpath elements in another ClasspathElementOrder after the elements in this order.java.util.LinkedHashSet<java.lang.String>
getOrder()
Get the order of classpath elements.
-
-
-
Method Detail
-
getOrder
public java.util.LinkedHashSet<java.lang.String> getOrder()
Get the order of classpath elements.
-
addClasspathElements
public boolean addClasspathElements(java.lang.String pathStr, java.lang.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(java.lang.String pathElement, java.lang.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(java.lang.Object pathObject, java.lang.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(java.lang.String pathStr, java.lang.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.
-
addClasspathElements
public boolean addClasspathElements(ClasspathOrder subsequentOrder)
Add all classpath elements in another ClasspathElementOrder after the elements in this order.- Parameters:
subsequentOrder
- the ordering to add after this one.- Returns:
- true, if at least one element was added (i.e. was not a duplicate).
-
-