Interface LanguageSupport

    • Method Detail

      • getLanguageSupport

        static LanguageSupport getLanguageSupport​(Path path)
        Returns the LanguageSupport implementation for the given file.
        Parameters:
        path - The path to a file.
        Returns:
        The LanguageSupport implementation or an empty optional if none was found.
      • isLanguageSupported

        static boolean isLanguageSupported​(Path path)
        Determines whether there exists a LanguageSupport implementation for the given path.
        Parameters:
        path - The path to a file.
        Returns:
        Whether such implementation exists.
        Since:
        1.1.0
      • parseFullCompilationUnitSupported

        default boolean parseFullCompilationUnitSupported()
        When returning true, the framework will not use the line base import parser but will instead try to parse the whole source file using parseCompilationUnit(Path, Charset).
        Returns:
        Whether this implementation supports full compilation unit parsing.
        Since:
        2.1.0
      • getSupportedFileExtensions

        Set<String> getSupportedFileExtensions()
        The set of supported file extensions. Extensions returned here are case insensitive and may or may not start with a '.' (dot).
        Returns:
        The set of file extensions.
      • parsePackage

        Optional<String> parsePackage​(String line)
        Parses the given line and returns the declared package
        Parameters:
        line - Line in the source file
        Returns:
        The package declared
      • parseImport

        List<ImportStatement> parseImport​(String importLine,
                                          int lineNumber)
        Extract the package names that this import statement represents. As some languages allow to specify multiple imports in a single line, this method returns a list.

        e.g. import java.util.List; The above should return java.util.List in a Java source file.

        Parameters:
        importLine - Line in the source file
        lineNumber - The line number of the import.
        Returns:
        Fully qualified package name that this import represents