Interface IScriptFile
public interface IScriptFile
Represents a script file which will be read during a
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 Summary
Modifier and TypeMethodDescriptionGets the unaltered contents of the file.default booleanhasMatchesFor(IPreprocessor preprocessor) Gets whether the file has any matches for the specified preprocessor.matchesFor(IPreprocessor preprocessor) Gets all preprocessor matches for the given preprocessor in the current file.name()The name of the script file.Gets the contents of the file after preprocessing.Attempts to convert this script file into a ZenCodeSourceFile.
-
Method Details
-
name
String name()The name of the script file.- Returns:
- The name of the script file.
- Since:
- 9.1.0
-
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
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 ZenCodeSourceFile.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
Optionalwrapping aSourceFilerepresenting this file, if possible; an empty optional otherwise. - Since:
- 9.1.0
-
matchesFor
Gets all preprocessor matches for the given preprocessor in the current file.Refer to
IPreprocessorandIPreprocessor.Matchfor 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
Gets whether the file has any matches for the specified preprocessor.Refer to
IPreprocessorandIPreprocessor.Matchfor 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
-