Class AbstractContext<T extends AbstractContext>

java.lang.Object
org.qubership.atp.macros.core.processor.AbstractContext<T>
Direct Known Subclasses:
SimpleContext

public abstract class AbstractContext<T extends AbstractContext> extends Object
  • Field Details

    • parent

      protected final T extends AbstractContext parent
    • contextMap

      protected Map<DataKey,Object> contextMap
    • contextParameters

      protected Map<String,Object> contextParameters
    • strategy

      protected org.qubership.atp.macros.core.processor.MacrosVisitorState strategy
  • Constructor Details

  • Method Details

    • notifyMacroStarts

      protected abstract void notifyMacroStarts(@Nonnull MacrosParser.MacrosStartContext macro, @Nonnull Macros macros, @Nonnull Evaluator evaluator)
      Initializes with macro. Should clear args in case it was uninitialized previously and reused for next sibling now.
    • pushArguments

      protected abstract void pushArguments(@Nonnull MacrosParser.MacrosStartContext args)
      Invoked only on initialized context (in the macro). Will be invoked when user has defined a macro which does not exist. May be interpreted as text by default.
      Parameters:
      args - - the part of an arguments text.
    • pushArguments

      protected abstract void pushArguments(@Nonnull MacrosParser.TextContext args)
      Invoked only on initialized context (in the macro).
      Parameters:
      args - - the part of an arguments text.
    • pushArguments

      protected abstract void pushArguments(@Nonnull MacrosParser.QuoteContext args)
      Invoked only on initialized context (in the macro).
      Parameters:
      args - - the part of an arguments text.
    • pushArguments

      protected abstract void pushArguments(@Nonnull MacrosParser.SlashContext args)
      Invoked only on initialized context (in the macro).
      Parameters:
      args - - the part of an arguments text.
    • pushArguments

      protected abstract void pushArguments(@Nonnull MacrosParser.MacroParamsContext args)
      Invoked only on initialized context (in the macro).
      Parameters:
      args - - the part of an arguments text.
    • pushArguments

      protected abstract void pushArguments(@Nonnull MacrosParser.MacrosEndContext args)
      Invoked only on initialized context (in the macro). Will be invoked when user has defined a macro which does not exist. May be interpreted as text by default.
      Parameters:
      args - - the part of an arguments text.
    • notifyMacroEnds

      protected abstract void notifyMacroEnds(MacrosParser.MacrosEndContext ctx)
      Args are filled up now. Result of evaluation should be pushed into state text.
    • pushText

      protected abstract void pushText(@Nonnull MacrosParser.MacrosStartContext text)
      Invoked only on uninitialized context (outside the macro). Will be invoked when user has defined a macro which does not exist. May be interpreted as text by default.
      Parameters:
      text - - the part of an arguments text.
    • pushText

      protected abstract void pushText(@Nonnull MacrosParser.TextContext text)
      Invoked only on uninitialized context (outside the macro).
      Parameters:
      text - - the part of an arguments text.
    • pushText

      protected abstract void pushText(@Nonnull MacrosParser.QuoteContext text)
    • pushText

      protected abstract void pushText(@Nonnull MacrosParser.SlashContext text)
    • pushText

      protected abstract void pushText(@Nonnull MacrosParser.MacroParamsContext text)
    • pushText

      protected abstract void pushText(@Nonnull MacrosParser.MacrosEndContext text)
      Invoked only on uninitialized context (outside the macro). Will be invoked when user has defined a macro which does not exist. May be interpreted as text by default.
      Parameters:
      text - - the part of an arguments text.
    • createChildContext

      @Nonnull protected abstract T createChildContext(@Nonnull MacrosParser.MacrosStartContext ctx, @Nonnull Macros macros, Evaluator evaluator)
      Invoked when macro denoted by current context contains another macro as argument. So child context will be bound to the nested macro.
    • reduce

      protected abstract void reduce(@Nonnull MacrosParser.MacrosEndContext ctx, @Nonnull T child)
      Invoked on parent to notify that child (nested macro) is fully processed and should be aggregated with parent.
      Parameters:
      child - - child context which will be dropped by processor.
    • reset

      public abstract T reset()
    • getResultOnEvaluationEnd

      @Nullable public abstract String getResultOnEvaluationEnd()