java.lang.Object
org.matwoess.jsourceprofiler.tool.model.JavaFile
All Implemented Interfaces:
Serializable

public class JavaFile extends Object implements Serializable
Model class representing a java file.

Stores the package name, the top level classes and the found blocks.

It also stores the source file path and the relative path to the sources root.

See Also:
  • Field Details

    • beginOfImports

      public int beginOfImports
    • packageName

      public String packageName
    • topLevelClasses

      public List<JClass> topLevelClasses
    • foundBlocks

      public List<Block> foundBlocks
    • sourceFile

      public transient Path sourceFile
    • relativePath

      public transient Path relativePath
  • Constructor Details

    • JavaFile

      public JavaFile(Path sourceFile, Path sourcesDir)
      Creates a new JavaFile object based on a source file path and its parent root directory path.

      The given source file will be stored as-is while the directory will be used to determine a relative path between the directory and this source file. This relative path is important to mirror the original project structure in the instrumented directory and for the report file hierarchy.

      Parameters:
      sourceFile - the source file path
      sourcesDir - the top-level sources root directory
    • JavaFile

      public JavaFile(Path sourceFile)
      Like JavaFile(Path, Path) but relative to the current working directory. The relative path will be set to the file name itself.
  • Method Details

    • getClassesRecursive

      public List<JClass> getClassesRecursive()
      Returns a list of all classes in this file, including inner classes recursively.
      Returns:
      the list of all classes in this file