Interface TextStateParser.State<M>

Type Parameters:
M - the type of the model object
Enclosing class:
TextStateParser<M>

public static interface TextStateParser.State<M>
Represents a parsing state that processes lines belonging to a specific section of the input.

While this state is active, each line that does not trigger a state transition is passed to onLine. When the parser is about to switch to a different state or reaches the end of input, commit is called to finalize any accumulated data.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    commit(M model)
    Finalizes this state.
    void
    onLine(String line, M model)
    Processes a single line within the current state.
  • Method Details

    • onLine

      void onLine(String line, M model)
      Processes a single line within the current state. The line is passed in its original form (without trimming).
      Parameters:
      line - the line of text to process
      model - the model to update
    • commit

      void commit(M model)
      Finalizes this state. Called when the parser is about to transition to a different state or when the end of input is reached. After this method is called, the state is discarded and no further calls to onLine will be made for it.
      Parameters:
      model - the model to finalize