Class ClassResolverFromClasspath
java.lang.Object
com.tngtech.archunit.core.importer.resolvers.ClassResolverFromClasspath
- All Implemented Interfaces:
ClassResolver
public final class ClassResolverFromClasspath extends java.lang.Object implements ClassResolver
A
ClassResolver
that tries to locate missing dependencies on the classpath.
I.e. uses Class.getResource(String)
to find the URI
of the classfile for the missing
type, then uses the supplied ClassResolver.ClassUriImporter
to import the type.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.tngtech.archunit.core.importer.resolvers.ClassResolver
ClassResolver.ClassUriImporter, ClassResolver.Factory
-
Constructor Summary
Constructors Constructor Description ClassResolverFromClasspath()
-
Method Summary
Modifier and Type Method Description void
setClassUriImporter(ClassResolver.ClassUriImporter classUriImporter)
Always called BEFOREClassResolver.tryResolve(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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
ClassResolverFromClasspath
public ClassResolverFromClasspath()
-
-
Method Details
-
setClassUriImporter
Description copied from interface:ClassResolver
Always called BEFOREClassResolver.tryResolve(String)
.- Specified by:
setClassUriImporter
in interfaceClassResolver
- Parameters:
classUriImporter
- to import aJavaClass
from any suppliedURI
-
tryResolve
Description copied from interface:ClassResolver
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, ...)- Specified by:
tryResolve
in interfaceClassResolver
- Parameters:
typeName
- The type name to resolve asJavaClass
- Returns:
- Optional.of(resolvedClass), if the
JavaClass
could be successfully imported, otherwise Optional.absent()
-