Interface LifecycleUser<T extends JobParameters>

All Known Implementing Classes:
ChannelFilter, HandlerTarget, HandlerTargetImpl, LifecycleUserImpl, MultiFilter, NewlineFilter, ParsedReplaceTarget, ParsedReplaceTargetImpl, ReplaceTarget, RunPhase, SearchTerminals, SearchTerminalsDynamic, SearchTerminalsImpl, StringFilter, TerminalReplaceTarget, TerminalReplaceTargetImpl, ThrowTarget, ThrowTargetImpl, TokenFilter, Transformation, TransformationPhase, WalkPhase, WrapIdentifier, WrapIdentifierDynamic, WrapIdentifierExternalDeclaration, WrapThrowTarget, WrapThrowTargetImpl

public interface LifecycleUser<T extends JobParameters>
Implemented by classes that have an execution planner parent and can receive job parameters. All lifecycle users are notified of init and reset events as well as job parameters by the execution planner. init() is called the before the first reset while the reset resetState() is called for every transformation job. For transformations, state is reset before execution starts. For transformation phases, state is reset before the phase's execution level is executed.
  • Method Summary

    Modifier and Type
    Method
    Description
    default T
    Returns the execution planner's current job parameters.
    default Lexer
    Returns the executing execution planner's lexer.
    default Parser
    Returns the executing execution planner's parser.
    Returns the execution planner set on this child.
    default io.github.douira.glsl_transformer.GLSLParser.TranslationUnitContext
    Returns the root node taken from the execution planner that is currently executing this phase.
    default void
    Called when this object is set up in a processing environment like the printer or the execution planner.
    default void
    Is called before the first execution by the execution planner.
    boolean
    Checks if this lifecycle user has been initialized.
    default void
    Called before this object is used on a job.
    void
    Marks this lifecycle user as initialized.
    void
    Sets the parent planner of this child.
  • Method Details

    • setPlanner

      void setPlanner(ExecutionPlanner<T> planner)
      Sets the parent planner of this child.
      Parameters:
      planner - The execution planner to set as the parent
    • getPlanner

      ExecutionPlanner<T> getPlanner()
      Returns the execution planner set on this child.
      Returns:
      The currently set execution planner
    • getParser

      default Parser getParser()
      Returns the executing execution planner's parser.
      Returns:
      The parser
    • getLexer

      default Lexer getLexer()
      Returns the executing execution planner's lexer.
      Returns:
      The lexer
    • getRootNode

      default io.github.douira.glsl_transformer.GLSLParser.TranslationUnitContext getRootNode()
      Returns the root node taken from the execution planner that is currently executing this phase.
      Returns:
      The root node of the current executing execution planner
    • getJobParameters

      default T getJobParameters()
      Returns the execution planner's current job parameters.
      Returns:
      The execution planner's current job parameters
      See Also:
      • ExecutionPlanner.getJobParameters()
    • isInitialized

      boolean isInitialized()
      Checks if this lifecycle user has been initialized.
      Returns:
      True if initialized, false otherwise
    • setInitialized

      void setInitialized()
      Marks this lifecycle user as initialized.
    • initOnce

      default void initOnce()
      Is called before the first execution by the execution planner. This method may be called multiple times but the implementing class should implement isInitialized() and setInitialized() to ensure that only one initialization is performed.
    • init

      default void init()
      Called when this object is set up in a processing environment like the printer or the execution planner.
    • resetState

      default void resetState()
      Called before this object is used on a job. This is called before each transformation/printing job. This method is called in a dependency-satisfying order on the phases. No guarantees on the relationship between when this method is called and when the implementing class is activated (walk/run for transformation phases) are given.