Class ArgumentParserToken

java.lang.Object
net.apartium.cocoabeans.commands.lexer.CommandToken
net.apartium.cocoabeans.commands.lexer.ArgumentParserToken
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
SimpleArgumentParserToken

@AvailableSince("0.0.37") public abstract class ArgumentParserToken extends CommandToken
A token that represents an argument parser.
See Also:
  • Constructor Details

    • ArgumentParserToken

      protected ArgumentParserToken(int from, int to, String text)
      Create a new argument parser token
      Parameters:
      from - starting index
      to - ending index
      text - the entire text of command
  • Method Details

    • getType

      public CommandTokenType getType()
      Get the type of the token
      Specified by:
      getType in class CommandToken
      Returns:
      CommandTokenType.ARGUMENT_PARSER
    • getParser

      public abstract RegisterArgumentParser<?> getParser(Map<String,ArgumentParser<?>> parsers)
      Gets the argument parser from the given parsers map
      Parameters:
      parsers - parser map that represents all argument parsers we have
      Returns:
      the argument parser
    • getParserName

      public abstract String getParserName()
      Gets the argument parser name
      Returns:
      the argument parser name
    • getParameterName

      public abstract Optional<String> getParameterName()
      Gets the parameter name of the argument parser if it has one
      Returns:
      the parameter name
    • isOptional

      public abstract boolean isOptional()
      Gets if the argument parser is optional
      Returns:
      true if the argument parser is optional
    • optionalNotMatch

      public abstract boolean optionalNotMatch()
      Gets if the argument parser is optional but does not match
      Returns:
      true if the argument parser is optional but does not match