Class DirSourceLocation

  • All Implemented Interfaces:
    SourceLocation

    public class DirSourceLocation
    extends java.lang.Object
    implements SourceLocation
    Represents Java source in a directory, such as in a project's source folder.
    Version:
    1.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.File dir  
    • Field Detail

      • dir

        private java.io.File dir
    • Constructor Detail

      • DirSourceLocation

        public DirSourceLocation​(java.lang.String dir)
        Constructor.
        Parameters:
        dir - The directory containing the source files.
      • DirSourceLocation

        public DirSourceLocation​(java.io.File dir)
        Constructor.
        Parameters:
        dir - The directory containing the source files.
    • Method Detail

      • getCompilationUnit

        public CompilationUnit getCompilationUnit​(ClassFile cf)
                                           throws java.io.IOException
        Returns an AST for the specified class file.
        Specified by:
        getCompilationUnit in interface SourceLocation
        Parameters:
        cf - The class file to grab the AST for.
        Returns:
        The AST, or null if it cannot be found.
        Throws:
        java.io.IOException - If an IO error occurs.
      • getLocationAsString

        public java.lang.String getLocationAsString()
        Returns a string representation of this source location. For locations on disk such as zip files or directories, this should be the full path to the resource.
        Specified by:
        getLocationAsString in interface SourceLocation
        Returns:
        The location of this source as a string, or null if it is not an accessible location.