Class SourceCodeLocation


public final class SourceCodeLocation
extends java.lang.Object
Location in the source code of an ArchUnit domain object.

Consider, e.g., a JavaAccess from com.myapp.MyClass line number 28 to another class com.any.OtherClass. Then the SourceCodeLocation would be

A SourceCodeLocation will always only be as precise as possible from the point of Java bytecode. A field of a class, e.g., com.myapp.MyClass would always give
since there is no way to precisely determine the line number of a JavaField from bytecode.
See Also:
  • Method Summary

    Modifier and Type Method Description
    boolean equals​(java.lang.Object obj)  
    int hashCode()  
    static SourceCodeLocation of​(JavaClass sourceClass)  
    static SourceCodeLocation of​(JavaClass sourceClass, int lineNumber)  
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Method Details

    • of

      @PublicAPI(usage=ACCESS) public static SourceCodeLocation of​(JavaClass sourceClass)
    • of

      @PublicAPI(usage=ACCESS) public static SourceCodeLocation of​(JavaClass sourceClass, int lineNumber)
    • hashCode

      public int hashCode()
      hashCode in class java.lang.Object
    • equals

      public boolean equals​(java.lang.Object obj)
      equals in class java.lang.Object
    • toString

      public java.lang.String toString()
      toString in class java.lang.Object
      "(${sourceClass.getSimpleName()}.java:${lineNumber})". This format is (at least by IntelliJ Idea) recognized as location, if it's the end of a line, thus enabling IDE support to jump to a definition.