Class CompilationUnit.Storage

  • Enclosing class:
    CompilationUnit

    public static class CompilationUnit.Storage
    extends Object
    Information about where this compilation unit was loaded from. This class only stores the absolute location. For more flexibility use SourceRoot.
    • Method Detail

      • getPath

        public Path getPath()
        Returns:
        the path to the source for this CompilationUnit
      • getCompilationUnit

        public CompilationUnit getCompilationUnit()
        Returns:
        the CompilationUnit this Storage is about.
      • getSourceRoot

        public Path getSourceRoot()
        Returns:
        the source root directory, calculated from the path of this compiation unit, and the package declaration of this compilation unit. If the package declaration is invalid (when it does not match the end of the path) a RuntimeException is thrown.
      • getFileName

        public String getFileName()
      • getDirectory

        public Path getDirectory()
      • save

        public void save()
        Saves the compilation unit to its original location
      • save

        public void save​(Function<CompilationUnit,​String> makeOutput)
        Saves a compilation unit to its original location with formatting according to the function passed as a parameter.
        Parameters:
        makeOutput - a function that formats the compilation unit