Package com.tngtech.archunit.core.domain
Class Dependency
java.lang.Object
com.tngtech.archunit.core.domain.Dependency
- All Implemented Interfaces:
HasDescription
,HasSourceCodeLocation
,Comparable<Dependency>
@PublicAPI(usage=ACCESS)
public final class Dependency
extends Object
implements HasDescription, Comparable<Dependency>, HasSourceCodeLocation
Represents a dependency of one Java class on another Java class. Such a dependency can occur by either of the
following:
- a class accesses a field of another class
- a class calls a method/constructor of another class
- a class inherits from another class
- a class implements an interface
- a class has a field with type of another class
- a class has a method/constructor with parameter/return type of another class
- a class (or method/constructor of this class) declares a type parameter referencing another class
- a class (or method/constructor of this class) is annotated with an annotation of a certain type or referencing another class as annotation parameter
- a method/constructor of a class references another class in a throws declaration
- a class references another class object (e.g.
Example.class
) - a class references another class in an
instanceof
check
Dependency
will by definition never be a self-reference,
i.e. origin
will never be equal to target
.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Predefinedfunctions
to transformDependency
.static final class
Predefinedpredicates
targetingDependency
. -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
int
hashCode()
toString()
static JavaClasses
toTargetClasses
(Iterable<Dependency> dependencies)
-
Method Details
-
getOriginClass
-
getTargetClass
-
getDescription
- Specified by:
getDescription
in interfaceHasDescription
-
getSourceCodeLocation
- Specified by:
getSourceCodeLocation
in interfaceHasSourceCodeLocation
- Returns:
- The
SourceCodeLocation
of this object, i.e. how to locate the respective object within the set of source files.
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Dependency>
-
hashCode
public int hashCode() -
equals
-
toString
-
toTargetClasses
@PublicAPI(usage=ACCESS) public static JavaClasses toTargetClasses(Iterable<Dependency> dependencies)
-