Interface ClassResolver
- All Known Implementing Classes:
ClassResolverFromClasspath,SelectedClassResolverFromClasspath
The
For example, if you import the package
Before any call of
ClassFileImporter will use the configured ClassResolver, to determine how to
resolve further dependencies.For example, if you import the package
com.foo.bar, and some class com.foo.bar.FooBar
calls a method of com.other.Dependency, the ClassResolver 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 of
tryResolve(String), ArchUnit will always call
setClassUriImporter(ClassUriImporter) and supply a respective ClassUriImporter.
Thus the job of ClassResolver is just, to resolve the correct URI, where to locate the class.
The ClassUriImporter can then import any given URI as a JavaClass.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceProvides a way to import a JavaClass from a givenURI.static final class -
Method Summary
Modifier and TypeMethodDescriptionvoidsetClassUriImporter(ClassResolver.ClassUriImporter classUriImporter) Always called BEFOREtryResolve(String).tryResolve(String typeName) ArchUnit will call this method, to resolve any missingJavaClasses, needed to build the class graph (i.e.
-
Method Details
-
setClassUriImporter
Always called BEFOREtryResolve(String). -
tryResolve
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, ...)
-