Interface ClassResolver
-
- All Known Implementing Classes:
ClassResolverFromClasspath,SelectedClassResolverFromClasspath
@PublicAPI(usage=INHERITANCE) public interface ClassResolver
TheClassFileImporterwill use the configuredClassResolver, to determine how to resolve further dependencies.
For example, if you import the packagecom.foo.bar, and some classcom.foo.bar.FooBarcalls a method ofcom.other.Dependency, theClassResolverwill 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 ofClassResolveris just, to resolve the correctURI, where to locate the class. TheClassUriImportercan then import any givenURIas aJavaClass.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceClassResolver.ClassUriImporterProvides a way to import a JavaClass from a givenURI.static classClassResolver.Factory
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidsetClassUriImporter(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 aJavaClassfrom 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, ...)
-
-