Interface SourceExcerptProvider

  • All Known Implementing Classes:
    AbstractCompiler, Compiler, SimpleSourceExcerptProvider

    public interface SourceExcerptProvider
    A source excerpt provider is responsible for building source code excerpt of specific locations, such as a specific line or a region around a given line number.
    • Method Detail

      • getSourceLine

        java.lang.String getSourceLine​(java.lang.String sourceName,
                                       int lineNumber)
        Get the line indicated by the line number. This call will return only the specific line.
        Parameters:
        lineNumber - the line number, 1 being the first line of the file
        Returns:
        the line indicated, or null if it does not exist
      • getSourceRegion

        Region getSourceRegion​(java.lang.String sourceName,
                               int lineNumber)
        Get a region around the indicated line number. The exact definition of a region is implementation specific, but it must contain the line indicated by the line number. A region must not start or end by a carriage return.
        Parameters:
        lineNumber - the line number, 1 being the first line of the file
        Returns:
        the region around the line number indicated, or null if it does not exist