Package com.tngtech.archunit.core.domain
Class Dependency
java.lang.Object
com.tngtech.archunit.core.domain.Dependency
- All Implemented Interfaces:
HasDescription
,HasSourceCodeLocation
,java.lang.Comparable<Dependency>
public class Dependency extends java.lang.Object implements HasDescription, java.lang.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 of another class
- a class calls a constructor of another class
- a class inherits from another class (which is in fact a special case of constructor call)
- 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
Dependency
will by definition never be a self-reference,
i.e. origin
will never be equal to target
.-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Dependency.Functions
static class
Dependency.Predicates
-
Method Summary
Modifier and Type Method Description int
compareTo(Dependency o)
boolean
equals(java.lang.Object obj)
java.lang.String
getDescription()
JavaClass
getOriginClass()
SourceCodeLocation
getSourceCodeLocation()
JavaClass
getTargetClass()
int
hashCode()
java.lang.String
toString()
static JavaClasses
toTargetClasses(java.lang.Iterable<Dependency> dependencies)
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
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 interfacejava.lang.Comparable<Dependency>
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
toTargetClasses
@PublicAPI(usage=ACCESS) public static JavaClasses toTargetClasses(java.lang.Iterable<Dependency> dependencies)
-