Class MatchedTokenConsumer<T>

java.lang.Object
net.kyori.adventure.text.minimessage.internal.parser.match.MatchedTokenConsumer<T>
Type Parameters:
T - the return result
Direct Known Subclasses:
StringResolvingMatchedTokenConsumer, TokenListProducingMatchedTokenConsumer

public abstract class MatchedTokenConsumer<T> extends Object
A consumer of a region of a string that was identified as a token.
Since:
4.10.0
  • Field Details

    • input

      protected final String input
  • Constructor Details

    • MatchedTokenConsumer

      public MatchedTokenConsumer(String input)
      Creates a new matched token consumer.
      Parameters:
      input - the input
      Since:
      4.10.0
  • Method Details

    • accept

      @MustBeInvokedByOverriders public void accept(int start, int end, TokenType tokenType)
      Accepts a matched token.
      Parameters:
      start - the start of the token
      end - the end of the token
      tokenType - the type of the token
      Since:
      4.10.0
    • result

      public abstract @UnknownNullability T result()
      Gets the result of this consumer, if any.
      Returns:
      the result
      Since:
      4.10.0
    • lastEndIndex

      public final int lastEndIndex()
      The last accepted end index, or -1 if no match has been accepted.
      Returns:
      the last accepted end index
      Since:
      4.10.0