Interface ArgumentParser<C,T>
-
- Type Parameters:
C
- Command sender typeT
- Value type
- All Known Implementing Classes:
BooleanArgument.BooleanParser
,ByteArgument.ByteParser
,CharArgument.CharacterParser
,DoubleArgument.DoubleParser
,EnumArgument.EnumParser
,FlagArgument.FlagArgumentParser
,FloatArgument.FloatParser
,IntegerArgument.IntegerParser
,ShortArgument.ShortParser
,StringArgument.StringParser
,StringArrayArgument.StringArrayParser
,UUIDArgument.UUIDParser
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ArgumentParser<C,T>
Parser that parses strings into values of a specific type
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_ARGUMENT_COUNT
Default amount of arguments that the parser expects to consume
-
Method Summary
Modifier and Type Method Description default int
getRequestedArgumentCount()
Get the amount of arguments that this parsers seeks to consumedefault boolean
isContextFree()
Check whether or not this argument parser is context free.@NonNull ArgumentParseResult<@NonNull T>
parse(@NonNull CommandContext<@NonNull C> commandContext, @NonNull java.util.Queue<@NonNull java.lang.String> inputQueue)
Parse command input into a command resultdefault @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
-
-
-
Field Detail
-
DEFAULT_ARGUMENT_COUNT
static final int DEFAULT_ARGUMENT_COUNT
Default amount of arguments that the parser expects to consume- See Also:
- Constant Field Values
-
-
Method Detail
-
parse
@NonNull ArgumentParseResult<@NonNull T> parse(@NonNull CommandContext<@NonNull C> commandContext, @NonNull java.util.Queue<@NonNull java.lang.String> inputQueue)
Parse command input into a command result- Parameters:
commandContext
- Command contextinputQueue
- The queue of arguments- Returns:
- Parsed command result
-
suggestions
default @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- Parameters:
commandContext
- Command contextinput
- Input string- Returns:
- List of suggestions
-
isContextFree
default boolean isContextFree()
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- Returns:
true
if the parser is context free, elsefalse
-
getRequestedArgumentCount
default int getRequestedArgumentCount()
Get the amount of arguments that this parsers seeks to consume- Returns:
- The number of arguments tha the parser expects
- Since:
- 1.1.0
-
-