Class ClasspathSourceLocation

java.lang.Object
org.fife.rsta.ac.java.buildpath.ClasspathSourceLocation
All Implemented Interfaces:
SourceLocation

public class ClasspathSourceLocation extends Object implements SourceLocation
Represents Java source files somewhere on the classpath. This might be somewhat of a unique situation, since often source isn't on the classpath, only class files are. However, there may be times when you want to ship both the classes and source for a library and put them on your classpath for simplicity of integrating with this code completion library. In such a case, you would use a ClasspathLibraryInfo and use this class for the source location.

This class has no state; any classes it's asked about, it assumes it can find the corresponding .java file somewhere on the classpath using the class's ClassLoader.

Version:
1.0
See Also:
  • Constructor Details

    • ClasspathSourceLocation

      public ClasspathSourceLocation()
  • Method Details

    • getCompilationUnit

      public CompilationUnit getCompilationUnit(ClassFile cf)
      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.
    • getLocationAsString

      public 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.