java.lang.Object
net.kyori.adventure.text.minimessage.internal.parser.Token

public final class Token extends Object
Represents a token for the lexer.
Since:
4.10.0
  • Constructor Details

    • Token

      public Token(int startIndex, int endIndex, TokenType type)
      Creates a new token.
      Parameters:
      startIndex - the start index of the token
      endIndex - the end index of the token
      type - the type of the token
      Since:
      4.10.0
  • Method Details

    • startIndex

      public int startIndex()
      Returns the start index of this token.
      Returns:
      the start index
      Since:
      4.10.0
    • endIndex

      public int endIndex()
      Returns the end index of this token.
      Returns:
      the end index
      Since:
      4.10.0
    • type

      public TokenType type()
      Returns the type of this token.
      Returns:
      the type
      Since:
      4.10.0
    • childTokens

      public @Nullable List<Token> childTokens()
      Returns the children of this token.
      Returns:
      the child tokens
      Since:
      4.10.0
    • childTokens

      public void childTokens(List<Token> childTokens)
      Sets the children of this token.
      Parameters:
      childTokens - the new children
      Since:
      4.10.0
    • get

      public CharSequence get(CharSequence message)
      Get the value of this token from the complete message.
      Parameters:
      message - the message to read
      Returns:
      the value of this token
      Since:
      4.10.0
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object