Interface TextStateParser.NewStateLine<M>

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

public static interface TextStateParser.NewStateLine<M>
Detects a state boundary and creates the corresponding TextStateParser.State.

During the states phase, each trimmed line is passed to all registered NewStateLine matchers. If a matcher returns a non-null TextStateParser.State, the parser commits the current state and switches to the returned one. If all matchers return null, the line is dispatched to the current state via onLine.

  • Method Details

    • parse

      TextStateParser.State<M> parse(String line, TextStateParser.State<M> currentState, M model)
      Inspects the given line and optionally creates a new state for it.
      Parameters:
      line - the trimmed line to inspect
      currentState - the currently active state, may be null
      model - the model to associate with any newly created state
      Returns:
      a new TextStateParser.State instance if this line starts a new section, or null if no transition should occur