Class Locations
java.lang.Object
com.tngtech.archunit.core.importer.Locations
public final class Locations
extends java.lang.Object
Represents a set of
locations
of Java class files. Also offers methods to derive concrete locations (i.e. URIs) from
higher level concepts like packages or the classpath.-
Method Summary
Modifier and Type Method Description static java.util.Set<Location>
inClassPath()
static java.util.Set<Location>
of(java.lang.Iterable<java.net.URL> urls)
Directly converts the passed URLs tolocations
.static java.util.Set<Location>
ofClass(java.lang.Class<?> clazz)
Set oflocations
where the class file of the supplied class can be found.
Note that this is really a set, since the same (or in bad cases a different version of the same) class might be found within the classpath several times.static java.util.Set<Location>
ofPackage(java.lang.String pkg)
Alllocations
in the classpath that match the supplied package.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
of
@PublicAPI(usage=ACCESS) public static java.util.Set<Location> of(java.lang.Iterable<java.net.URL> urls)Directly converts the passed URLs tolocations
. URLs can be of class files as well as directories. They can also be JAR URLs of class files (e.g.jar:file:///some.jar!/some/Example.class
) or folders within JAR files. -
ofPackage
Alllocations
in the classpath that match the supplied package.- Parameters:
pkg
- the package to look for within the classpath- Returns:
Locations
of all paths that match the supplied package
-
ofClass
Set oflocations
where the class file of the supplied class can be found.
Note that this is really a set, since the same (or in bad cases a different version of the same) class might be found within the classpath several times.- Parameters:
clazz
- AClass
to import- Returns:
Locations
of the respective class file within the classpath
-
inClassPath
- Returns:
- All classes that can be found within the classpath. Note that ArchUnit does not distinguish between the classpath and the modulepath, thus for Java >= 9 all locations of class files from the modulepath with be returned as well.
-