Interface ClassResolver
-
- All Known Implementing Classes:
ClassResolverFromClasspath
,SelectedClassResolverFromClasspath
@PublicAPI(usage=INHERITANCE) public interface ClassResolver
TheClassFileImporter
will use the configuredClassResolver
, to determine how to resolve further dependencies.
For example, if you import the packagecom.foo.bar
, and some classcom.foo.bar.FooBar
calls a method ofcom.other.Dependency
, theClassResolver
will decide how this dependency should be treated, i.e. should the class tried to be located somehow, e.g. on the classpath, or should instead a stub with the respective type name be created.
Before any call oftryResolve(String)
, ArchUnit will always callsetClassUriImporter(ClassUriImporter)
and supply a respectiveClassUriImporter
. Thus the job ofClassResolver
is just, to resolve the correctURI
, where to locate the class. TheClassUriImporter
can then import any givenURI
as aJavaClass
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ClassResolver.ClassUriImporter
Provides a way to import a JavaClass from a givenURI
.static class
ClassResolver.Factory
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
setClassUriImporter(ClassResolver.ClassUriImporter classUriImporter)
Always called BEFOREtryResolve(String)
.Optional<JavaClass>
tryResolve(java.lang.String typeName)
ArchUnit will call this method, to resolve any missingJavaClasses
, needed to build the class graph (i.e.
-
-
-
Method Detail
-
setClassUriImporter
void setClassUriImporter(ClassResolver.ClassUriImporter classUriImporter)
Always called BEFOREtryResolve(String)
.- Parameters:
classUriImporter
- to import aJavaClass
from any suppliedURI
-
tryResolve
Optional<JavaClass> tryResolve(java.lang.String typeName)
ArchUnit will call this method, to resolve any missingJavaClasses
, needed to build the class graph (i.e. targets of method calls, field accesses, super classes, interfaces, ...)
-
-