Interface IScriptFile


public interface IScriptFile
Represents a script file which will be read during an IScriptRun.

The file might refer to a real file stored on disk, a fake file generated on the fly, or any other source of ZenCode code. No assumptions are made on the source of the file.

Since:
9.1.0
  • Method Details

    • name

      String name()
      The name of the script file.
      Returns:
      The name of the script file.
      Since:
      9.1.0
    • fileContents

      List<String> fileContents()
      Gets the unaltered contents of the file.

      The returned list is read only and is supposed to represent the effective state of the file prior to any preprocessing operations that might be carried out.

      Returns:
      The original file contents.
      Since:
      9.1.0
    • preprocessedContents

      List<String> preprocessedContents()
      Gets the contents of the file after preprocessing.

      The returned list is read only.

      Returns:
      The content of the file after preprocessing.
      Since:
      9.1.0
    • toSourceFile

      Optional<SourceFile> toSourceFile()
      Attempts to convert this script file into a ZenCode SourceFile.

      If conversion fails for any reason, either due to an error or because the file should not be exposed to ZenCode, then an empty optional will be returned.

      Returns:
      An Optional wrapping a SourceFile representing this file, if possible; an empty optional otherwise.
      Since:
      9.1.0
    • matchesFor

      List<IPreprocessor.Match> matchesFor(IPreprocessor preprocessor)
      Gets all preprocessor matches for the given preprocessor in the current file.

      Refer to IPreprocessor and IPreprocessor.Match for more information.

      Parameters:
      preprocessor - The preprocessor whose matches should be queried.
      Returns:
      A read-only list containing all matches for that specific preprocessor.
      Since:
      9.1.0
    • hasMatchesFor

      default boolean hasMatchesFor(IPreprocessor preprocessor)
      Gets whether the file has any matches for the specified preprocessor.

      Refer to IPreprocessor and IPreprocessor.Match for more information.

      Parameters:
      preprocessor - The preprocessor whose matches should be queried.
      Returns:
      Whether there is at least one match for the given preprocessor.
      Since:
      9.1.0