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 Type
    Method
    Description
    default boolean
    Invoked after all source transformations are finished.
    default void
    Invoked before source files are visited for transformation.
    void
    visitFile(com.intellij.psi.PsiFile psiFile, Replacements replacements)
    Visit the given psiFile for transformation.
  • Method Details

    • beforeRun

      default void beforeRun(TransformContext context)
      Invoked before source files are visited for transformation.

      Can be used for loading data from CLI parameters.

      Parameters:
      context - the transform context
    • afterRun

      default boolean afterRun(TransformContext context)
      Invoked after all source transformations are finished.

      Can be used for post-transformation validation.

      Parameters:
      context - the transform context
      Returns:
      true if the transformation was successful, false otherwise
    • visitFile

      void visitFile(com.intellij.psi.PsiFile psiFile, Replacements replacements)
      Visit the given psiFile for transformation.
      Parameters:
      psiFile - the file being transformed
      replacements - the replacement collector, used to replace the value of psi tree elements