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 totarget
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Dependency.Functions
static class
Dependency.Predicates
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods 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)
-
-
-
Method Detail
-
getOriginClass
@PublicAPI(usage=ACCESS) public JavaClass getOriginClass()
-
getTargetClass
@PublicAPI(usage=ACCESS) public JavaClass getTargetClass()
-
getDescription
@PublicAPI(usage=ACCESS) public java.lang.String getDescription()
- Specified by:
getDescription
in interfaceHasDescription
-
getSourceCodeLocation
@PublicAPI(usage=ACCESS) public SourceCodeLocation 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
@PublicAPI(usage=ACCESS) public int compareTo(Dependency o)
- 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)
-
-