Class StringArgument.StringParser<C>

  • All Implemented Interfaces:
    ArgumentParser<C,​java.lang.String>
    Enclosing class:
    StringArgument<C>

    public static final class StringArgument.StringParser<C>
    extends java.lang.Object
    implements ArgumentParser<C,​java.lang.String>
    • Constructor Summary

      Constructors 
      Constructor Description
      StringParser​(@NonNull StringArgument.StringMode stringMode, @NonNull java.util.function.BiFunction<@NonNull CommandContext<C>,​@NonNull java.lang.String,​@NonNull java.util.List<@NonNull java.lang.String>> suggestionsProvider)
      Construct a new string parser
    • Method Summary

      Modifier and Type Method Description
      @NonNull StringArgument.StringMode getStringMode()
      Get the string mode
      boolean isContextFree()
      Check whether or not this argument parser is context free.
      @NonNull ArgumentParseResult<java.lang.String> parse​(@NonNull CommandContext<C> commandContext, @NonNull java.util.Queue<@NonNull java.lang.String> inputQueue)
      Parse command input into a command result
      @NonNull java.util.List<@NonNull java.lang.String> suggestions​(@NonNull CommandContext<C> commandContext, @NonNull java.lang.String input)
      Get a list of suggested arguments that would be correctly parsed by this parser
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StringParser

        public StringParser​(@NonNull StringArgument.StringMode stringMode,
                            @NonNull java.util.function.BiFunction<@NonNull CommandContext<C>,​@NonNull java.lang.String,​@NonNull java.util.List<@NonNull java.lang.String>> suggestionsProvider)
        Construct a new string parser
        Parameters:
        stringMode - String parsing mode
        suggestionsProvider - Suggestions provider
    • Method Detail

      • parse

        public @NonNull ArgumentParseResult<java.lang.String> parse​(@NonNull CommandContext<C> commandContext,
                                                                    @NonNull java.util.Queue<@NonNull java.lang.String> inputQueue)
        Description copied from interface: ArgumentParser
        Parse command input into a command result
        Specified by:
        parse in interface ArgumentParser<C,​java.lang.String>
        Parameters:
        commandContext - Command context
        inputQueue - The queue of arguments
        Returns:
        Parsed command result
      • suggestions

        public @NonNull java.util.List<@NonNull java.lang.String> suggestions​(@NonNull CommandContext<C> commandContext,
                                                                              @NonNull java.lang.String input)
        Description copied from interface: ArgumentParser
        Get a list of suggested arguments that would be correctly parsed by this parser
        Specified by:
        suggestions in interface ArgumentParser<C,​java.lang.String>
        Parameters:
        commandContext - Command context
        input - Input string
        Returns:
        List of suggestions
      • isContextFree

        public boolean isContextFree()
        Description copied from interface: ArgumentParser
        Check whether or not this argument parser is context free. A context free parser will not use the provided command context, and so supports impromptu parsing
        Specified by:
        isContextFree in interface ArgumentParser<C,​java.lang.String>
        Returns:
        true if the parser is context free, else false