Class ModuleNameExtractor

java.lang.Object
org.ek9lang.cli.coverage.ModuleNameExtractor
All Implemented Interfaces:
Function<String,String>, UnaryOperator<String>

final class ModuleNameExtractor extends Object implements UnaryOperator<String>
Extracts module name from EK9 source file. Single responsibility: file parsing for module name. Parses the 'defines module' declaration from the source file.
  • Constructor Details

    • ModuleNameExtractor

      ModuleNameExtractor(Path sourceDirectory)
      Create an extractor that resolves paths relative to the given directory.
      Parameters:
      sourceDirectory - The root directory for resolving relative paths
  • Method Details

    • apply

      public String apply(String relativePath)
      Extract the module name from a source file.
      Specified by:
      apply in interface Function<String,String>
      Parameters:
      relativePath - The relative path to the source file (starting with "./")
      Returns:
      The module name, or a default name if extraction fails