Package net.neoforged.jst.api
Interface SourceTransformer
public interface SourceTransformer
Transformers are created through
plugins, and handle source replacements.
Transformers will be given to picocli for option collection, so they can accept CLI parameters. It is strongly recommended that transformers prefix their options with the transformer name.
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanafterRun(TransformContext context) Invoked after all source transformations are finished.default voidbeforeRun(TransformContext context) Invoked before source files are visited for transformation.voidvisitFile(com.intellij.psi.PsiFile psiFile, Replacements replacements) Visit the givenpsiFilefor transformation.
-
Method Details
-
beforeRun
Invoked before source files are visited for transformation.Can be used for loading data from CLI parameters.
- Parameters:
context- the transform context
-
afterRun
Invoked after all source transformations are finished.Can be used for post-transformation validation.
- Parameters:
context- the transform context- Returns:
trueif the transformation was successful,falseotherwise
-
visitFile
Visit the givenpsiFilefor transformation.- Parameters:
psiFile- the file being transformedreplacements- the replacement collector, used to replace the value of psi tree elements
-